npm package diff

Package: @forge/tunnel

Versions: 5.6.1-next.1 - 5.7.0-next.2

File: package/out/services/create-tunnel-service.js

Index: package/out/services/create-tunnel-service.js
===================================================================
--- package/out/services/create-tunnel-service.js
+++ package/out/services/create-tunnel-service.js
@@ -23,9 +23,21 @@
             '--url': `localhost:${port}`,
             '--protocol': 'http2'
         };
         options[id] = null;
-        const { connections, stop } = (0, cloudflared_1.tunnel)(options);
+        process.env['TUNNEL_LOGLEVEL'] = 'debug';
+        const { connections, stop, child } = (0, cloudflared_1.tunnel)(options);
+        child.stdout?.on('data', (chunk) => this.logger.debug(cli_shared_1.Text.tunnel.cloudflaredLog(chunk)));
+        child.stderr?.on('data', (chunk) => this.logger.debug(cli_shared_1.Text.tunnel.cloudflaredLog(chunk)));
+        child.on('error', (err) => {
+            this.logger.error(err);
+            throw new cli_shared_1.BaseError(cli_shared_1.Text.tunnel.error.cloudflaredError);
+        });
+        child.on('exit', (code) => {
+            if (code !== 0) {
+                throw new cli_shared_1.BaseError(cli_shared_1.Text.tunnel.error.cloudflaredExit(code));
+            }
+        });
         await Promise.all(connections);
         this.stopFunction = stop;
         this.logger.debug(cli_shared_1.Text.tunnel.startedTunnel(tunnelUrl));
         return new url_1.URL(tunnelUrl);