File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -373,14 +373,14 @@ export class TcpCatReadLine extends EventEmitter {
373373 this . tcpClient . setEncoding ( this . encoding ) ;
374374 }
375375 this . tcpClient . on ( 'data' , this . onDataCb . bind ( this ) ) ;
376- this . tcpClient . once ( 'close' , this . onCloseCb . bind ( this ) ) ;
377- this . tcpClient . once ( 'error' , ( e ) => {
378- if ( ( e as any ) . code === 'ECONNREFUSED' ) {
379- // We expect this when there is no server running. Do nothing
380- } else {
381- console . log ( e ) ;
382- process . exit ( 0 ) ;
383- }
376+ this . tcpClient . on ( 'close' , this . onCloseCb . bind ( this ) ) ;
377+ this . tcpClient . on ( 'error' , ( e ) => {
378+ // It is normal to get 'ECONNREFUSED' but on Windows you may also get
379+ // ECONNRESET. We expect 'ECONNREFUSED' if the server has not yet started.
380+ // Just ignore the errors as the connection fails or closes anyways
381+
382+ // const code = (e as any).code ;
383+ // console.log(`Error code = ${code}`);
384384 } ) ;
385385 this . tcpClient . connect ( this . port , this . host , cb ) ;
386386 }
@@ -605,4 +605,9 @@ try {
605605}
606606catch ( e ) {
607607 console . error ( e ) ;
608+ console . error ( e . stack ) ;
609+ console . error ( 'tcpCat crashed... Use Ctrl-C to exit' ) ;
610+ setInterval ( ( ) => {
611+ console . error ( 'tcpCat crashed... Use Ctrl-C to exit' ) ;
612+ } , 1000 ) ;
608613}
You can’t perform that action at this time.
0 commit comments