From 613241cdcb347f10ae6780ddf2d57d111d501ef9 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 28 May 2019 11:14:32 +0200 Subject: [PATCH] fix(core): update --- ts/smartshell.classes.smartshell.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ts/smartshell.classes.smartshell.ts b/ts/smartshell.classes.smartshell.ts index f56a8d7..54d8d58 100644 --- a/ts/smartshell.classes.smartshell.ts +++ b/ts/smartshell.classes.smartshell.ts @@ -166,17 +166,31 @@ export class Smartshell { * @param regexArg */ public async execInteractive(commandStringArg: string) { + if (process.env.CI) { + return; + } const done = plugins.smartpromise.defer(); const shell = cp.spawn('sh', [], { stdio: 'pipe' }); this.smartexit.addProcess(shell); const shellLog = new ShellLog(); - process.stdin.pipe(shell.stdin); - shell.stdout.pipe(process.stdout); + 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'); 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; } }