now has working wait for line method

This commit is contained in:
2017-06-26 15:46:15 +02:00
parent 92d26a574c
commit 6d56a09dd7
9 changed files with 30 additions and 68 deletions

View File

@@ -19,8 +19,8 @@ export class Smartshell {
}
}
addSourceFiles(sourceFilePathsArray: string[]) {
for(let sourceFilePath of sourceFilePathsArray) {
addSourceFiles (sourceFilePathsArray: string[]) {
for (let sourceFilePath of sourceFilePathsArray) {
this.sourceFileArray.push(sourceFilePath)
}
}

View File

@@ -70,12 +70,12 @@ export let execStreaming = (commandStringArg: string) => {
/**
* executes a command and returns promise that will be fullfilled once an putput line matches RegexArg
* @param commandStringArg
* @param regexArg
* @param regexArg
*/
export let execAndWaitForLine = (commandStringArg: string, regexArg: RegExp) => {
let done = plugins.smartq.defer()
let execStreamingResult = execStreaming(commandStringArg)
execStreamingResult.childProcess.on('data', (stdOutChunk: string) => {
execStreamingResult.childProcess.stdout.on('data', (stdOutChunk: string) => {
if (regexArg.test(stdOutChunk)) {
done.resolve()
}