@@ -22,13 +22,12 @@ export default ({ Superclass }) => {
2222| ____|__ __ ___ ___ _ _ | |_ ___
2323| _| \\ \\/ // _ \\ / __|| | | || __|/ _ \\
2424| |___ > <| __/| (__ | |_| || |_| __/
25- |_____|/_/\\_\\\\___| \\___| \\__,_| \\__|\\___|
26- ${ this . command } ${ this . argument } `;
25+ |_____|/_/\\_\\\\___| \\___| \\__,_| \\__|\\___|` ;
2726 let childProcess ;
2827 switch ( this . implementation ) {
2928 case 'spawn' :
3029 try {
31- console . log ( message )
30+ console . log ( message ) ; console . log ( ` ${ this . command } ${ this . argument } ` )
3231 childProcess = spawnSync ( this . command , this . argument , this . option )
3332 if ( childProcess . status > 0 ) throw childProcess . error
3433 } catch ( error ) {
@@ -37,7 +36,7 @@ ${this.command} ${this.argument}`;
3736 break ;
3837 case 'spawnAsynchronous' :
3938 try {
40- console . log ( message )
39+ console . log ( message ) ; console . log ( ` ${ this . command } ${ this . argument } ` )
4140 childProcess = spawn ( this . command , this . argument , this . option )
4241 if ( childProcess . status > 0 ) throw childProcess . error
4342 } catch ( error ) {
@@ -46,19 +45,22 @@ ${this.command} ${this.argument}`;
4645 break ;
4746 case 'file' :
4847 try {
49- console . log ( message )
48+ console . log ( message ) ; console . log ( `shellscript file: ${ this . filename } ` )
5049 let appBasePath = '/project/application/source/containerInstallationNodejs/shellScript/'
5150 this . option . cwd = appBasePath
52- childProcess = spawn ( 'sh' , this . filename , this . option )
51+ childProcess = spawnSync ( `sh` , ` ${ this . filename } ` , this . option )
5352 if ( childProcess . status > 0 ) throw childProcess . error
5453 } catch ( error ) {
55- process . exit ( childProcess . status )
54+ let status = ( childProcess ) ? childProcess . status : 1 ;
55+ process . exit ( status )
5656 }
5757 break ;
5858 default :
5959 console . log ( 'shellscriptUnit.implementation does not match any option.' )
6060 break ;
6161 }
62+ // important to prevent 'unable to re-open stdin' error between shells.
63+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) // wait x seconds before next script execution.
6264 }
6365 }
6466 return self
0 commit comments