File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -105,16 +105,32 @@ function run (options, callback) {
105
105
logger ( 'Tunnel is ready' )
106
106
callback ( null , activeTunnel )
107
107
}
108
-
108
+
109
+ const onError = function ( waitCounter ) {
110
+ const errorMessage = `Tunnel failed to launch in ${ waitCounter } seconds.`
111
+ logger ( errorMessage )
112
+ callback ( new Error ( errorMessage ) , null )
113
+ }
114
+
109
115
const readyFile = path . join ( os . tmpdir ( ) , 'testingbot.ready' )
110
- const readyFileChecker = setInterval ( ( ) => {
111
- fs . stat ( readyFile , ( error , stat ) => {
116
+
117
+ function checkReadyFile ( waitCounter = 0 ) {
118
+ fs . access ( readyFile , fs . constants . F_OK , ( error ) => {
112
119
if ( ! error ) {
113
120
clearInterval ( readyFileChecker )
114
- onReady ( )
121
+ return onReady ( )
115
122
}
123
+
124
+ if ( waitCounter > 90 ) {
125
+ clearInterval ( readyFileChecker )
126
+ return onError ( waitCounter )
127
+ }
128
+
129
+ waitCounter += 1
116
130
} )
117
- } , 800 )
131
+ }
132
+
133
+ const readyFileChecker = setInterval ( ( ) => checkReadyFile ( ) , 1000 )
118
134
119
135
const args = createArgs ( options )
120
136
You can’t perform that action at this time.
0 commit comments