File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed
Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " cloudflared " : patch
3+ ---
4+
5+ Remove redundant error event listeners in Tunnel class
Original file line number Diff line number Diff line change 1- const { Tunnel } = require ( "cloudflared" ) ;
1+ const fs = require ( "node:fs" ) ;
2+ const { Tunnel, bin, install } = require ( "cloudflared" ) ;
23
34console . log ( "Cloudflared Tunnel Example." ) ;
45main ( ) ;
56
67async function main ( ) {
8+ if ( ! fs . existsSync ( bin ) ) {
9+ // install cloudflared binary
10+ await install ( bin ) ;
11+ }
12+
713 // run: cloudflared tunnel --hello-world
814 const tunnel = Tunnel . quick ( ) ;
915
Original file line number Diff line number Diff line change 1- import { Tunnel } from "cloudflared" ;
1+ import fs from "node:fs" ;
2+ import { Tunnel , bin , install } from "cloudflared" ;
23
34console . log ( "Cloudflared Tunnel Example." ) ;
45main ( ) ;
56
67async function main ( ) {
8+ if ( ! fs . existsSync ( bin ) ) {
9+ // install cloudflared binary
10+ await install ( bin )
11+ }
12+
713 // run: cloudflared tunnel --hello-world
814 const tunnel = Tunnel . quick ( ) ;
915
Original file line number Diff line number Diff line change @@ -76,14 +76,10 @@ export class Tunnel extends EventEmitter {
7676 // cloudflared outputs to stderr, but I think its better to listen to stdout too
7777 this . on ( "stdout" , ( output ) => {
7878 this . processOutput ( output ) ;
79- } ) . on ( "error" , ( err ) => {
80- this . emit ( "error" , err ) ;
8179 } ) ;
8280
8381 this . on ( "stderr" , ( output ) => {
8482 this . processOutput ( output ) ;
85- } ) . on ( "error" , ( err ) => {
86- this . emit ( "error" , err ) ;
8783 } ) ;
8884 }
8985
You can’t perform that action at this time.
0 commit comments