@@ -5,10 +5,10 @@ const path = require('path')
5
5
const { fetchLatest } = require ( 'gh-release-fetch' )
6
6
const { runProcess } = require ( './run-process' )
7
7
8
- async function createTunnel ( siteId , netlifyApiToken ) {
9
- await installTunnelClient ( )
8
+ async function createTunnel ( siteId , netlifyApiToken , log ) {
9
+ await installTunnelClient ( log )
10
10
11
- console . log ( 'Creating Live tunnel' )
11
+ log ( 'Creating Live tunnel' )
12
12
const url = `https://api.netlify.com/api/v1/live_sessions?site_id=${ siteId } `
13
13
14
14
const response = await fetch ( url , {
@@ -31,23 +31,23 @@ async function createTunnel(siteId, netlifyApiToken) {
31
31
32
32
async function connectTunnel ( session , netlifyApiToken , localPort , log , error ) {
33
33
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' )
38
37
}
39
38
40
- runProcess ( cmd , log , error )
39
+ log ( execPath , args )
40
+ runProcess ( { cmd : execPath , args : args } , log , error )
41
41
}
42
42
43
- async function installTunnelClient ( ) {
43
+ async function installTunnelClient ( log ) {
44
44
const binPath = path . join ( os . homedir ( ) , '.netlify' , 'tunnel' , 'bin' )
45
45
const execPath = path . join ( binPath , 'live-tunnel-client' )
46
46
if ( execExist ( execPath ) ) {
47
47
return
48
48
}
49
49
50
- console . log ( 'Installing Live Tunnel Client' )
50
+ log ( 'Installing Live Tunnel Client' )
51
51
52
52
const win = isWindows ( )
53
53
const platform = win ? 'windows' : process . platform
0 commit comments