@@ -33,17 +33,19 @@ export class BackgroundPty implements IPty {
3333 this . initialize ( ) ;
3434 }
3535
36- async spawn ( cmd : string , options ?: SpawnOptions ) : Promise < SpawnResult > {
36+ async spawn ( cmd : string | string [ ] , options ?: SpawnOptions ) : Promise < SpawnResult > {
3737 const spawnResult = await this . spawnSafe ( cmd , options ) ;
3838
3939 if ( spawnResult . status !== 'success' ) {
40- throw new SpawnError ( cmd , spawnResult . exitCode , spawnResult . data ) ;
40+ throw new SpawnError ( Array . isArray ( cmd ) ? cmd . join ( ' ' ) : cmd , spawnResult . exitCode , spawnResult . data ) ;
4141 }
4242
4343 return spawnResult ;
4444 }
4545
46- async spawnSafe ( cmd : string , options ?: SpawnOptions ) : Promise < SpawnResult > {
46+ async spawnSafe ( cmd : string | string [ ] , options ?: SpawnOptions ) : Promise < SpawnResult > {
47+ cmd = Array . isArray ( cmd ) ? cmd . join ( '\\\n' ) : cmd ;
48+
4749 // cid is command id
4850 const cid = nanoid ( 10 ) ;
4951 debugLog ( cid ) ;
@@ -104,7 +106,7 @@ export class BackgroundPty implements IPty {
104106 }
105107 } ) ;
106108
107- console . log ( `Running command ${ cmd } ${ options ?. cwd ? ` (cwd: ${ options . cwd } )` : '' } ` )
109+ console . log ( `Running command: ${ cmd } ${ options ?. cwd ? ` (cwd: ${ options . cwd } )` : '' } ` )
108110 this . basePty . write ( `${ command } \r` ) ;
109111
110112 } ) ) ;
@@ -130,19 +132,6 @@ export class BackgroundPty implements IPty {
130132 let outputBuffer = '' ;
131133
132134 return new Promise ( resolve => {
133- // zsh-specific commands
134- // switch (Utils.getShell()) {
135- // case Shell.ZSH: {
136- // this.basePty.write('setopt HIST_NO_STORE;\n');
137- // break;
138- // }
139- //
140- // default: {
141- // this.basePty.write('export HISTIGNORE=\'history*\';\n');
142- // break;
143- // }
144- // }
145-
146135 this . basePty . write ( ' unset PS1;\n' ) ;
147136 this . basePty . write ( ' unset PS0;\n' )
148137 this . basePty . write ( ' echo setup complete\\"\n' )
0 commit comments