@@ -5,10 +5,10 @@ const path = require('path')
55const { fetchLatest } = require ( 'gh-release-fetch' )
66const { runProcess } = require ( './run-process' )
77
8- async function createTunnel ( siteId , netlifyApiToken ) {
9- await installTunnelClient ( )
8+ async function createTunnel ( siteId , netlifyApiToken , log ) {
9+ await installTunnelClient ( log )
1010
11- console . log ( 'Creating Live tunnel' )
11+ log ( 'Creating Live tunnel' )
1212 const url = `https://api.netlify.com/api/v1/live_sessions?site_id=${ siteId } `
1313
1414 const response = await fetch ( url , {
@@ -31,23 +31,23 @@ async function createTunnel(siteId, netlifyApiToken) {
3131
3232async function connectTunnel ( session , netlifyApiToken , localPort , log , error ) {
3333 const execPath = path . join ( os . homedir ( ) , '.netlify' , 'tunnel' , 'bin' , 'live-tunnel-client' )
34-
35- const proc = {
36- cmd : execPath ,
37- args : [ 'connect' , '-s' , session . id , '-t' , netlifyApiToken , '-l' , localPort ]
34+ const args = [ 'connect' , '-s' , session . id , '-t' , netlifyApiToken , '-l' , localPort ]
35+ if ( process . env . DEBUG ) {
36+ args . push ( '-v' )
3837 }
3938
40- runProcess ( cmd , log , error )
39+ log ( execPath , args )
40+ runProcess ( { cmd : execPath , args : args } , log , error )
4141}
4242
43- async function installTunnelClient ( ) {
43+ async function installTunnelClient ( log ) {
4444 const binPath = path . join ( os . homedir ( ) , '.netlify' , 'tunnel' , 'bin' )
4545 const execPath = path . join ( binPath , 'live-tunnel-client' )
4646 if ( execExist ( execPath ) ) {
4747 return
4848 }
4949
50- console . log ( 'Installing Live Tunnel Client' )
50+ log ( 'Installing Live Tunnel Client' )
5151
5252 const win = isWindows ( )
5353 const platform = win ? 'windows' : process . platform
0 commit comments