fix(core): update

This commit is contained in:
Philipp Kunz 2019-05-28 11:14:32 +02:00
parent f5df21e144
commit 613241cdcb

View File

@ -166,17 +166,31 @@ export class Smartshell {
* @param regexArg * @param regexArg
*/ */
public async execInteractive(commandStringArg: string) { public async execInteractive(commandStringArg: string) {
if (process.env.CI) {
return;
}
const done = plugins.smartpromise.defer(); const done = plugins.smartpromise.defer();
const shell = cp.spawn('sh', [], { stdio: 'pipe' }); const shell = cp.spawn('sh', [], { stdio: 'pipe' });
this.smartexit.addProcess(shell); this.smartexit.addProcess(shell);
const shellLog = new ShellLog(); const shellLog = new ShellLog();
process.stdin.pipe(shell.stdin); const stdInStream = process.stdin.pipe(shell.stdin);
shell.stdout.pipe(process.stdout); const stdOutStream = shell.stdout.pipe(process.stdout);
shell.on('close', code => { shell.on('close', code => {
console.log(`interactive shell terminated with code ${code}`); console.log(`interactive shell terminated with code ${code}`);
stdInStream.removeAllListeners();
stdInStream.uncork();
stdOutStream.removeAllListeners();
stdOutStream.unpipe();
shell.kill('SIGTERM');
done.resolve(); done.resolve();
}); });
shell.stdin.write(commandStringArg + '\n'); let commandString = commandStringArg;
if (process.env.CI) {
commandString += ' && exit';
}
commandString += '\n';
shell.stdin.write(commandString);
await done.promise; await done.promise;
} }
} }