@@ -51,8 +51,6 @@ class Exec2 {
5151 * log: true
5252 */
5353 async spawnAsync ( cmd : string , opt : SpawnAsyncOptions = { } ) : Promise < SpawnOutput > {
54- const started = Date . now ( )
55- this . logStart ( cmd , opt )
5654 const {
5755 shell = true ,
5856 printWhileRunning = true ,
@@ -63,10 +61,13 @@ class Exec2 {
6361 passProcessEnv = true ,
6462 forceColor = hasColors ,
6563 } = opt
64+ opt . log ??= printWhileRunning // by default log should be true, as we are printing the output
65+ const started = Date . now ( )
66+ this . logStart ( cmd , opt )
6667 let stdout = ''
6768 let stderr = ''
6869
69- if ( printWhileRunning ) console . log ( '' ) // 1-line padding before the output
70+ // if (printWhileRunning) console.log('') // 1-line padding before the output
7071
7172 return await new Promise < SpawnOutput > ( ( resolve , reject ) => {
7273 const p = cp . spawn ( cmd , opt . args || [ ] , {
@@ -99,7 +100,7 @@ class Exec2 {
99100 } )
100101
101102 p . on ( 'close' , code => {
102- if ( printWhileRunning ) console . log ( '' ) // 1-line padding after the output
103+ // if (printWhileRunning) console.log('') // 1-line padding after the output
103104 const isSuccessful = ! code
104105 this . logFinish ( cmd , opt , started , isSuccessful )
105106 const exitCode = code || 0
@@ -130,10 +131,11 @@ class Exec2 {
130131 * log: true
131132 */
132133 spawn ( cmd : string , opt : SpawnOptions = { } ) : void {
134+ const { shell = true , cwd, env, passProcessEnv = true , forceColor = hasColors } = opt
135+ opt . log ??= true // by default log should be true, as we are printing the output
133136 const started = Date . now ( )
134137 this . logStart ( cmd , opt )
135- const { shell = true , cwd, env, passProcessEnv = true , forceColor = hasColors } = opt
136- console . log ( '' ) // 1-line padding before the output
138+ // console.log('') // 1-line padding before the output
137139
138140 const r = cp . spawnSync ( cmd , opt . args , {
139141 encoding : 'utf8' ,
@@ -147,7 +149,7 @@ class Exec2 {
147149 } ,
148150 } )
149151
150- console . log ( '' ) // 1-line padding after the output
152+ // console.log('') // 1-line padding after the output
151153 const isSuccessful = ! r . error && ! r . status
152154 this . logFinish ( cmd , opt , started , isSuccessful )
153155
0 commit comments