Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion node/test/toolrunnerTestsWithExecAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ describe('Toolrunner Tests With ExecAsync', function () {
})
}
})
it.skip('Exec pipe output to file and another tool, fails if second tool fails', function (done) {
it('Exec pipe output to file and another tool, fails if second tool fails', function (done) {
this.timeout(20000);

var _testExecOptions = <trm.IExecOptions>{
Expand Down
2 changes: 1 addition & 1 deletion node/test/toolrunnertests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ describe('Toolrunner Tests', function () {
})
}
})
it.skip('Exec pipe output to file and another tool, fails if second tool fails', function (done) {
it('Exec pipe output to file and another tool, fails if second tool fails', function (done) {
this.timeout(20000);

var _testExecOptions = <trm.IExecOptions>{
Expand Down
20 changes: 18 additions & 2 deletions node/toolrunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,20 @@ export class ToolRunner extends events.EventEmitter {
});
}

let stdinEpipe = false;
cp.stdin?.on("error", (err: Error) => {
if (!im.isSigPipeError(err)) {
throw err;
}
stdinEpipe = true;
});
//pipe stdout of first tool to stdin of second tool
cpFirst.stdout?.on('data', (data: Buffer) => {
try {
if (fileStream) {
fileStream.write(data);
}
if (!cp.stdin?.destroyed) {
if (!cp.stdin?.destroyed && !cp.stdin?.writableEnded && !stdinEpipe) {
cp.stdin?.write(data);
}
} catch (err) {
Expand Down Expand Up @@ -871,13 +878,22 @@ export class ToolRunner extends events.EventEmitter {
});
}

let stdinEpipe = false;
cp.stdin?.on("error", (err: Error) => {
if (!im.isSigPipeError(err)) {
throw err;
}
stdinEpipe = true;
});
//pipe stdout of first tool to stdin of second tool
cpFirst.stdout?.on('data', (data: Buffer) => {
try {
if (fileStream) {
fileStream.write(data);
}
cp.stdin?.write(data);
if (!cp.stdin?.destroyed && !cp.stdin?.writableEnded && !stdinEpipe) {
cp.stdin?.write(data);
}
} catch (err) {
this._debug('Failed to pipe output of ' + toolPathFirst + ' to ' + toolPath);
this._debug(toolPath + ' might have exited due to errors prematurely. Verify the arguments passed are valid.');
Expand Down