@@ -154,16 +154,16 @@ function startDevServer(settings, log, error) {
154
154
server . start ( function ( ) {
155
155
log ( `${ NETLIFYDEV } Server listening to` , settings . proxyPort ) ;
156
156
} ) ;
157
- } else {
158
- log ( `${ NETLIFYDEV } Starting Netlify Dev with ${ settings . type } ` ) ;
159
- const ps = execa ( settings . command , settings . args , {
160
- env : settings . env ,
161
- stdio : "inherit"
162
- } ) ;
163
- ps . on ( "close" , code => process . exit ( code ) ) ;
164
- ps . on ( "SIGINT" , process . exit ) ;
165
- ps . on ( "SIGTERM" , process . exit ) ;
157
+ return ;
166
158
}
159
+ log ( `${ NETLIFYDEV } Starting Netlify Dev with ${ settings . type } ` ) ;
160
+ const ps = execa ( settings . command , settings . args , {
161
+ env : settings . env ,
162
+ stdio : "inherit"
163
+ } ) ;
164
+ ps . on ( "close" , code => process . exit ( code ) ) ;
165
+ ps . on ( "SIGINT" , process . exit ) ;
166
+ ps . on ( "SIGTERM" , process . exit ) ;
167
167
}
168
168
169
169
class DevCommand extends Command {
@@ -202,19 +202,6 @@ class DevCommand extends Command {
202
202
}
203
203
204
204
let url ;
205
- if ( flags . live ) {
206
- const liveSession = await createTunnel ( site . id , accessToken , this . log ) ;
207
- url = liveSession . session_url ;
208
- process . env . BASE_URL = url ;
209
-
210
- await connectTunnel (
211
- liveSession ,
212
- accessToken ,
213
- settings . port ,
214
- this . log ,
215
- this . error
216
- ) ;
217
- }
218
205
219
206
startDevServer ( settings , this . log , this . error ) ;
220
207
@@ -240,6 +227,22 @@ class DevCommand extends Command {
240
227
if ( ! url ) {
241
228
url = proxyUrl ;
242
229
}
230
+
231
+ if ( flags . live ) {
232
+ await waitPort ( { port : settings . proxyPort } ) ;
233
+ const liveSession = await createTunnel ( site . id , accessToken , this . log ) ;
234
+ url = liveSession . session_url ;
235
+ process . env . BASE_URL = url ;
236
+
237
+ await connectTunnel (
238
+ liveSession ,
239
+ accessToken ,
240
+ settings . port ,
241
+ this . log ,
242
+ this . error
243
+ ) ;
244
+ }
245
+
243
246
// Todo hoist this telemetry `command` to CLI hook
244
247
track ( "command" , {
245
248
command : "dev" ,
0 commit comments