fix(core): update
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartshell',
|
||||
version: '3.0.0',
|
||||
version: '3.0.1',
|
||||
description: 'shell actions designed as promises'
|
||||
}
|
||||
|
@ -39,38 +39,28 @@ export class Smartshell {
|
||||
|
||||
if (options.interactive) {
|
||||
if (process.env.CI) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const done = plugins.smartpromise.defer();
|
||||
const shell = cp.spawn('sh', [], { stdio: 'pipe' });
|
||||
const shell = cp.spawn('sh', [], { stdio: ['pipe', 'inherit', 'inherit'] });
|
||||
this.smartexit.addProcess(shell);
|
||||
|
||||
const stdInStream = process.stdin.pipe(shell.stdin);
|
||||
const stdOutStream = shell.stdout.pipe(process.stdout);
|
||||
|
||||
|
||||
shell.on('close', (code) => {
|
||||
console.log(`interactive shell terminated with code ${code}`);
|
||||
stdInStream.removeAllListeners();
|
||||
stdInStream.uncork();
|
||||
stdOutStream.removeAllListeners();
|
||||
stdOutStream.unpipe();
|
||||
shell.kill('SIGTERM');
|
||||
process.stdin.pause();
|
||||
done.resolve();
|
||||
console.log(`interactive shell terminated with code ${code}`);
|
||||
this.smartexit.removeProcess(shell);
|
||||
done.resolve();
|
||||
});
|
||||
|
||||
|
||||
let commandString = options.commandString;
|
||||
if (process.env.CI) {
|
||||
commandString += ' && exit';
|
||||
}
|
||||
commandString += '\n';
|
||||
|
||||
shell.stdin.write(commandString);
|
||||
|
||||
shell.stdin.write(commandString + '\n exit \n');
|
||||
|
||||
await done.promise;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const done = plugins.smartpromise.defer<IExecResult | IExecResultStreaming>();
|
||||
const childProcessEnded = plugins.smartpromise.defer<IExecResult>();
|
||||
|
Reference in New Issue
Block a user