From 6a1d0117c8442c2ce67fa0f3b832398a79328faf Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:32:44 +0200 Subject: [PATCH 01/16] Add signal handler for process execution --- node/test/toolrunnertests.ts | 70 ++++++++++++++++++++++++++++++++++++ node/toolrunner.ts | 19 ++++++---- 2 files changed, 82 insertions(+), 7 deletions(-) diff --git a/node/test/toolrunnertests.ts b/node/test/toolrunnertests.ts index 10e8f5f6c..98cc013b3 100644 --- a/node/test/toolrunnertests.ts +++ b/node/test/toolrunnertests.ts @@ -12,6 +12,8 @@ import * as trm from '../_build/toolrunner'; import testutil = require('./testutil'); +const signals: (number | NodeJS.Signals)[] = ['SIGTERM', 'SIGINT', 15, 2]; + describe('Toolrunner Tests', function () { before(function (done) { @@ -487,6 +489,74 @@ describe('Toolrunner Tests', function () { delete process.env['TASKLIB_TEST_TOOLRUNNER_EXITDELAY']; }); }) + signals.forEach(signal => { + it(`Handle child process killing with ${signal} signal`, function (done) { + this.timeout(10000); + + let semaphorePath = path.join(testutil.getTestTemp(), 'child-process-semaphore.txt'); + fs.writeFileSync(semaphorePath, ''); + + let nodePath = tl.which('node', true); + let scriptPath = path.join(__dirname, 'scripts', 'wait-for-file.js'); + let shell: trm.ToolRunner; + if (os.platform() == 'win32') { + shell = tl.tool(tl.which('cmd.exe', true)) + .arg('/D') // Disable execution of AutoRun commands from registry. + .arg('/E:ON') // Enable command extensions. Note, command extensions are enabled by default, unless disabled via registry. + .arg('/V:OFF') // Disable delayed environment expansion. Note, delayed environment expansion is disabled by default, unless enabled via registry. + .arg('/S') // Will cause first and last quote after /C to be stripped. + .arg('/C') + .arg(`"start "" /B "${nodePath}" "${scriptPath}" "file=${semaphorePath}""`); + } + else { + shell = tl.tool(tl.which('bash', true)) + .arg('-c') + .arg(`node '${scriptPath}' 'file=${semaphorePath}' &`); + } + + let toolRunnerDebug = []; + shell.on('debug', function (data) { + toolRunnerDebug.push(data); + }); + + process.env['TASKLIB_TEST_TOOLRUNNER_EXITDELAY'] = "500"; // 0.5 seconds + + let options = { + cwd: __dirname, + env: process.env, + silent: false, + failOnStdErr: true, + ignoreReturnCode: false, + outStream: process.stdout, + errStream: process.stdout, + windowsVerbatimArguments: true + }; + + shell.exec(options) + .then(function () { + done(new Error('should not have been successful')); + done(); + }) + .catch(function (err) { + if (typeof signal === 'number') { + const convertedSignal = Object.keys(os.constants.signals).find(x => os.constants.signals[x] == signal); + assert(toolRunnerDebug.filter(x => x.indexOf(`Signal ${convertedSignal} received from tool`) >= 0).length > 0); + } else { + assert(toolRunnerDebug.filter(x => x.indexOf(`Signal ${signal} received from tool`) >= 0).length > 0); + } + done(); + }) + .catch(function (err) { + done(err); + }) + .finally(function () { + fs.unlinkSync(semaphorePath); + delete process.env['TASKLIB_TEST_TOOLRUNNER_EXITDELAY']; + }); + + shell.killChildProcess(signal); + }); + }); it('Handles child process holding streams open and non-zero exit code', function (done) { this.timeout(10000); diff --git a/node/toolrunner.ts b/node/toolrunner.ts index 48dcc2b73..a80a60aeb 100644 --- a/node/toolrunner.ts +++ b/node/toolrunner.ts @@ -1180,18 +1180,20 @@ export class ToolRunner extends events.EventEmitter { state.CheckComplete(); }); - cp.on('exit', (code: number, signal: any) => { + cp.on('exit', (code: number, signal: number | NodeJS.Signals) => { state.processExitCode = code; state.processExited = true; this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); + this._debug(`Signal ${signal} received from tool '${this.toolPath}'`); state.CheckComplete() }); - cp.on('close', (code: number, signal: any) => { + cp.on('close', (code: number, signal: number | NodeJS.Signals) => { state.processExitCode = code; state.processExited = true; state.processClosed = true; this._debug(`STDIO streams have closed for tool '${this.toolPath}'`) + this._debug(`Signal ${signal} received from tool '${this.toolPath}'`); state.CheckComplete(); }); @@ -1312,18 +1314,20 @@ export class ToolRunner extends events.EventEmitter { state.CheckComplete(); }); - cp.on('exit', (code: number, signal: any) => { + cp.on('exit', (code: number, signal: number | NodeJS.Signals) => { state.processExitCode = code; state.processExited = true; this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); + this._debug(`Signal ${signal} received from tool '${this.toolPath}'`); state.CheckComplete() }); - cp.on('close', (code: number, signal: any) => { + cp.on('close', (code: number, signal: number | NodeJS.Signals) => { state.processExitCode = code; state.processExited = true; state.processClosed = true; - this._debug(`STDIO streams have closed for tool '${this.toolPath}'`) + this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); + this._debug(`Signal ${signal} received from tool '${this.toolPath}'`); state.CheckComplete(); }); @@ -1374,9 +1378,10 @@ export class ToolRunner extends events.EventEmitter { * Used to close child process by sending SIGNINT signal. * It allows executed script to have some additional logic on SIGINT, before exiting. */ - public killChildProcess(): void { + public killChildProcess(signal: number | NodeJS.Signals = "SIGINT"): void { if (this.childProcess) { - this.childProcess.kill(); + this._debug(`[killChildProcess] Signal ${signal} received`); + this.childProcess.kill(signal); } } } From 4564340605a4897cfd15cda9aacdcb11532008da Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:31:48 +0200 Subject: [PATCH 02/16] Update node/toolrunner.ts Co-authored-by: Konstantin Tyukalov <52399739+KonstantinTyukalov@users.noreply.github.com> --- node/toolrunner.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node/toolrunner.ts b/node/toolrunner.ts index a80a60aeb..d7cecd991 100644 --- a/node/toolrunner.ts +++ b/node/toolrunner.ts @@ -1326,8 +1326,7 @@ export class ToolRunner extends events.EventEmitter { state.processExitCode = code; state.processExited = true; state.processClosed = true; - this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); - this._debug(`Signal ${signal} received from tool '${this.toolPath}'`); + this._debug(`STDIO streams have closed and received signal ${signal} for tool '${this.toolPath}'`); state.CheckComplete(); }); From c99f66ef4b0745eb5ea9889d044401aba78a552a Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:34:30 +0200 Subject: [PATCH 03/16] Update outputs --- node/toolrunner.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/node/toolrunner.ts b/node/toolrunner.ts index d7cecd991..ab5febf19 100644 --- a/node/toolrunner.ts +++ b/node/toolrunner.ts @@ -1183,8 +1183,7 @@ export class ToolRunner extends events.EventEmitter { cp.on('exit', (code: number, signal: number | NodeJS.Signals) => { state.processExitCode = code; state.processExited = true; - this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); - this._debug(`Signal ${signal} received from tool '${this.toolPath}'`); + this._debug(`STDIO streams have closed and received exit code ${code} and signal ${signal} for tool '${this.toolPath}'`); state.CheckComplete() }); @@ -1192,8 +1191,7 @@ export class ToolRunner extends events.EventEmitter { state.processExitCode = code; state.processExited = true; state.processClosed = true; - this._debug(`STDIO streams have closed for tool '${this.toolPath}'`) - this._debug(`Signal ${signal} received from tool '${this.toolPath}'`); + this._debug(`STDIO streams have closed and received exit code ${code} and signal ${signal} for tool '${this.toolPath}'`); state.CheckComplete(); }); @@ -1317,8 +1315,7 @@ export class ToolRunner extends events.EventEmitter { cp.on('exit', (code: number, signal: number | NodeJS.Signals) => { state.processExitCode = code; state.processExited = true; - this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); - this._debug(`Signal ${signal} received from tool '${this.toolPath}'`); + this._debug(`STDIO streams have closed and received exit code ${code} and signal ${signal} for tool '${this.toolPath}'`); state.CheckComplete() }); @@ -1326,7 +1323,7 @@ export class ToolRunner extends events.EventEmitter { state.processExitCode = code; state.processExited = true; state.processClosed = true; - this._debug(`STDIO streams have closed and received signal ${signal} for tool '${this.toolPath}'`); + this._debug(`STDIO streams have closed and received exit code ${code} and signal ${signal} for tool '${this.toolPath}'`); state.CheckComplete(); }); From a591821eb0d47002512323c13beb6989c49f5c9a Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:45:49 +0200 Subject: [PATCH 04/16] Remove default signal value in killChildProcess method --- node/toolrunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/toolrunner.ts b/node/toolrunner.ts index ab5febf19..d6016df94 100644 --- a/node/toolrunner.ts +++ b/node/toolrunner.ts @@ -1374,7 +1374,7 @@ export class ToolRunner extends events.EventEmitter { * Used to close child process by sending SIGNINT signal. * It allows executed script to have some additional logic on SIGINT, before exiting. */ - public killChildProcess(signal: number | NodeJS.Signals = "SIGINT"): void { + public killChildProcess(signal?: number | NodeJS.Signals): void { if (this.childProcess) { this._debug(`[killChildProcess] Signal ${signal} received`); this.childProcess.kill(signal); From 99ecd3dcac2c45d2fe014d35db55f768af8d4714 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:53:07 +0200 Subject: [PATCH 05/16] Update assert --- node/test/toolrunnertests.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/node/test/toolrunnertests.ts b/node/test/toolrunnertests.ts index 98cc013b3..43590851d 100644 --- a/node/test/toolrunnertests.ts +++ b/node/test/toolrunnertests.ts @@ -539,11 +539,9 @@ describe('Toolrunner Tests', function () { }) .catch(function (err) { if (typeof signal === 'number') { - const convertedSignal = Object.keys(os.constants.signals).find(x => os.constants.signals[x] == signal); - assert(toolRunnerDebug.filter(x => x.indexOf(`Signal ${convertedSignal} received from tool`) >= 0).length > 0); - } else { - assert(toolRunnerDebug.filter(x => x.indexOf(`Signal ${signal} received from tool`) >= 0).length > 0); + signal = Object.keys(os.constants.signals).find(x => os.constants.signals[x] == signal); } + assert(toolRunnerDebug.filter(x => x.indexOf(`STDIO streams have closed and received exit code ${err} and signal ${signal} for tool 'node'`) >= 0).length > 0); done(); }) .catch(function (err) { From ab4ce785145cd0804723da7bc0219b8b9c2fdfda Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:06:50 +0200 Subject: [PATCH 06/16] Add default SIGKILL signal to killChildProcess --- node/test/toolrunnertests.ts | 4 ++-- node/toolrunner.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/node/test/toolrunnertests.ts b/node/test/toolrunnertests.ts index 43590851d..760838501 100644 --- a/node/test/toolrunnertests.ts +++ b/node/test/toolrunnertests.ts @@ -12,7 +12,7 @@ import * as trm from '../_build/toolrunner'; import testutil = require('./testutil'); -const signals: (number | NodeJS.Signals)[] = ['SIGTERM', 'SIGINT', 15, 2]; +const signals: (number | NodeJS.Signals)[] = ['SIGTERM', 'SIGINT', 'SIGKILL', 15, 2, 9]; describe('Toolrunner Tests', function () { @@ -539,7 +539,7 @@ describe('Toolrunner Tests', function () { }) .catch(function (err) { if (typeof signal === 'number') { - signal = Object.keys(os.constants.signals).find(x => os.constants.signals[x] == signal); + signal = Object.keys(os.constants.signals).find(x => os.constants.signals[x] == signal) as NodeJS.Signals; } assert(toolRunnerDebug.filter(x => x.indexOf(`STDIO streams have closed and received exit code ${err} and signal ${signal} for tool 'node'`) >= 0).length > 0); done(); diff --git a/node/toolrunner.ts b/node/toolrunner.ts index d6016df94..5ce1d4082 100644 --- a/node/toolrunner.ts +++ b/node/toolrunner.ts @@ -1374,7 +1374,7 @@ export class ToolRunner extends events.EventEmitter { * Used to close child process by sending SIGNINT signal. * It allows executed script to have some additional logic on SIGINT, before exiting. */ - public killChildProcess(signal?: number | NodeJS.Signals): void { + public killChildProcess(signal: number | NodeJS.Signals = "SIGKILL"): void { if (this.childProcess) { this._debug(`[killChildProcess] Signal ${signal} received`); this.childProcess.kill(signal); From 8a8d1c63acc274e57d54b92a1fbeefc1d5f1d0f5 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:15:19 +0200 Subject: [PATCH 07/16] Add toolRunnerDebug to console output --- node/test/toolrunnertests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/test/toolrunnertests.ts b/node/test/toolrunnertests.ts index 760838501..acfe57d82 100644 --- a/node/test/toolrunnertests.ts +++ b/node/test/toolrunnertests.ts @@ -541,6 +541,7 @@ describe('Toolrunner Tests', function () { if (typeof signal === 'number') { signal = Object.keys(os.constants.signals).find(x => os.constants.signals[x] == signal) as NodeJS.Signals; } + console.log("toolRunnerDebug", toolRunnerDebug); assert(toolRunnerDebug.filter(x => x.indexOf(`STDIO streams have closed and received exit code ${err} and signal ${signal} for tool 'node'`) >= 0).length > 0); done(); }) From 693efa9770e4600892faa4b5acc31200ab991061 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:18:12 +0200 Subject: [PATCH 08/16] Add default SIGTERM signal --- node/toolrunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/toolrunner.ts b/node/toolrunner.ts index 5ce1d4082..4d1873b91 100644 --- a/node/toolrunner.ts +++ b/node/toolrunner.ts @@ -1374,7 +1374,7 @@ export class ToolRunner extends events.EventEmitter { * Used to close child process by sending SIGNINT signal. * It allows executed script to have some additional logic on SIGINT, before exiting. */ - public killChildProcess(signal: number | NodeJS.Signals = "SIGKILL"): void { + public killChildProcess(signal: number | NodeJS.Signals = "SIGTERM"): void { if (this.childProcess) { this._debug(`[killChildProcess] Signal ${signal} received`); this.childProcess.kill(signal); From 5c653aead9c1557d76990522f07e9d4527a1086a Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:23:33 +0200 Subject: [PATCH 09/16] Move tool path to a variable --- node/test/toolrunnertests.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/node/test/toolrunnertests.ts b/node/test/toolrunnertests.ts index acfe57d82..6f080a51f 100644 --- a/node/test/toolrunnertests.ts +++ b/node/test/toolrunnertests.ts @@ -499,8 +499,10 @@ describe('Toolrunner Tests', function () { let nodePath = tl.which('node', true); let scriptPath = path.join(__dirname, 'scripts', 'wait-for-file.js'); let shell: trm.ToolRunner; + let tool; if (os.platform() == 'win32') { - shell = tl.tool(tl.which('cmd.exe', true)) + tool = tl.which('cmd.exe', true); + shell = tl.tool(tool) .arg('/D') // Disable execution of AutoRun commands from registry. .arg('/E:ON') // Enable command extensions. Note, command extensions are enabled by default, unless disabled via registry. .arg('/V:OFF') // Disable delayed environment expansion. Note, delayed environment expansion is disabled by default, unless enabled via registry. @@ -509,7 +511,8 @@ describe('Toolrunner Tests', function () { .arg(`"start "" /B "${nodePath}" "${scriptPath}" "file=${semaphorePath}""`); } else { - shell = tl.tool(tl.which('bash', true)) + tool = tl.which('bash', true); + shell = tl.tool(tool) .arg('-c') .arg(`node '${scriptPath}' 'file=${semaphorePath}' &`); } @@ -542,7 +545,7 @@ describe('Toolrunner Tests', function () { signal = Object.keys(os.constants.signals).find(x => os.constants.signals[x] == signal) as NodeJS.Signals; } console.log("toolRunnerDebug", toolRunnerDebug); - assert(toolRunnerDebug.filter(x => x.indexOf(`STDIO streams have closed and received exit code ${err} and signal ${signal} for tool 'node'`) >= 0).length > 0); + assert(toolRunnerDebug.filter(x => x.indexOf(`STDIO streams have closed and received exit code ${err} and signal ${signal} for tool '${tool}'`) >= 0).length > 0); done(); }) .catch(function (err) { From d60590d5ff7f99a6c74cf380394d75b78449607a Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:04:02 +0200 Subject: [PATCH 10/16] Set exit code as null --- node/test/toolrunnertests.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/node/test/toolrunnertests.ts b/node/test/toolrunnertests.ts index 6f080a51f..bbeea1a4f 100644 --- a/node/test/toolrunnertests.ts +++ b/node/test/toolrunnertests.ts @@ -488,7 +488,8 @@ describe('Toolrunner Tests', function () { fs.unlinkSync(semaphorePath); delete process.env['TASKLIB_TEST_TOOLRUNNER_EXITDELAY']; }); - }) + }); + signals.forEach(signal => { it(`Handle child process killing with ${signal} signal`, function (done) { this.timeout(10000); @@ -540,12 +541,11 @@ describe('Toolrunner Tests', function () { done(new Error('should not have been successful')); done(); }) - .catch(function (err) { + .catch(function () { if (typeof signal === 'number') { signal = Object.keys(os.constants.signals).find(x => os.constants.signals[x] == signal) as NodeJS.Signals; } - console.log("toolRunnerDebug", toolRunnerDebug); - assert(toolRunnerDebug.filter(x => x.indexOf(`STDIO streams have closed and received exit code ${err} and signal ${signal} for tool '${tool}'`) >= 0).length > 0); + assert(toolRunnerDebug.pop(), `STDIO streams have closed and received exit code null and signal ${signal} for tool '${tool}'`); done(); }) .catch(function (err) { @@ -559,6 +559,7 @@ describe('Toolrunner Tests', function () { shell.killChildProcess(signal); }); }); + it('Handles child process holding streams open and non-zero exit code', function (done) { this.timeout(10000); From 7b8d407ebdcdf1df659a986642c7dbe52d3ad6d5 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:10:40 +0200 Subject: [PATCH 11/16] Remove semaphore file logic --- node/test/toolrunnertests.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/node/test/toolrunnertests.ts b/node/test/toolrunnertests.ts index bbeea1a4f..8d8f57b82 100644 --- a/node/test/toolrunnertests.ts +++ b/node/test/toolrunnertests.ts @@ -494,11 +494,6 @@ describe('Toolrunner Tests', function () { it(`Handle child process killing with ${signal} signal`, function (done) { this.timeout(10000); - let semaphorePath = path.join(testutil.getTestTemp(), 'child-process-semaphore.txt'); - fs.writeFileSync(semaphorePath, ''); - - let nodePath = tl.which('node', true); - let scriptPath = path.join(__dirname, 'scripts', 'wait-for-file.js'); let shell: trm.ToolRunner; let tool; if (os.platform() == 'win32') { @@ -509,13 +504,13 @@ describe('Toolrunner Tests', function () { .arg('/V:OFF') // Disable delayed environment expansion. Note, delayed environment expansion is disabled by default, unless enabled via registry. .arg('/S') // Will cause first and last quote after /C to be stripped. .arg('/C') - .arg(`"start "" /B "${nodePath}" "${scriptPath}" "file=${semaphorePath}""`); + .arg("waitfor 3"); } else { tool = tl.which('bash', true); shell = tl.tool(tool) .arg('-c') - .arg(`node '${scriptPath}' 'file=${semaphorePath}' &`); + .arg("sleep 3"); } let toolRunnerDebug = []; @@ -523,8 +518,6 @@ describe('Toolrunner Tests', function () { toolRunnerDebug.push(data); }); - process.env['TASKLIB_TEST_TOOLRUNNER_EXITDELAY'] = "500"; // 0.5 seconds - let options = { cwd: __dirname, env: process.env, @@ -551,10 +544,6 @@ describe('Toolrunner Tests', function () { .catch(function (err) { done(err); }) - .finally(function () { - fs.unlinkSync(semaphorePath); - delete process.env['TASKLIB_TEST_TOOLRUNNER_EXITDELAY']; - }); shell.killChildProcess(signal); }); From 7f9ec4e9c56ee5431cef5f50f84bcd2dfa0aea0b Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:25:03 +0200 Subject: [PATCH 12/16] Bump 16.20.2 --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5e87603a9..278eb8be7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,7 +9,7 @@ trigger: variables: - group: npm-tokens - name: nodeVersion - value: '16.13.0' + value: '16.20.2' resources: repositories: From c2edca27deb098dc63e68a2ba7fd8d4a194eac8f Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:28:45 +0200 Subject: [PATCH 13/16] Update node version in test --- node/test/dirtests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/test/dirtests.ts b/node/test/dirtests.ts index cfea46310..65313b34b 100644 --- a/node/test/dirtests.ts +++ b/node/test/dirtests.ts @@ -31,7 +31,7 @@ describe('Dir Operation Tests', function () { this.timeout(1000); console.log('node version: ' + process.version); - const supportedNodeVersions = ['v16.13.0']; + const supportedNodeVersions = ['v16.20.2']; if (supportedNodeVersions.indexOf(process.version) === -1) { assert.fail(`expected node node version to be one of ${supportedNodeVersions.map(o => o).join(', ')}. actual: ` + process.version); } From 727391248cb234d657d7af277d309afd3253cadf Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:39:33 +0200 Subject: [PATCH 14/16] Update --- node/toolrunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/toolrunner.ts b/node/toolrunner.ts index 4d1873b91..e004982dd 100644 --- a/node/toolrunner.ts +++ b/node/toolrunner.ts @@ -678,7 +678,7 @@ export class ToolRunner extends events.EventEmitter { if (fileStream) { fileStream.write(data); } - cp.stdin?.write(data); + (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.'); From f3580e8660af2407f51cac2d92b9c3b1971d3862 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:46:59 +0200 Subject: [PATCH 15/16] Update --- azure-pipelines.yml | 4 +++- node/test/dirtests.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 278eb8be7..a446b385f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,7 +9,9 @@ trigger: variables: - group: npm-tokens - name: nodeVersion - value: '16.20.2' + value: '16.13.0' +- name: ONEES_ENFORCED_CODEQL_ENABLED # Disable CodeQL + value: false resources: repositories: diff --git a/node/test/dirtests.ts b/node/test/dirtests.ts index 65313b34b..cfea46310 100644 --- a/node/test/dirtests.ts +++ b/node/test/dirtests.ts @@ -31,7 +31,7 @@ describe('Dir Operation Tests', function () { this.timeout(1000); console.log('node version: ' + process.version); - const supportedNodeVersions = ['v16.20.2']; + const supportedNodeVersions = ['v16.13.0']; if (supportedNodeVersions.indexOf(process.version) === -1) { assert.fail(`expected node node version to be one of ${supportedNodeVersions.map(o => o).join(', ')}. actual: ` + process.version); } From 837354a01b2c5a11d505b7586f296392d0dbbdf2 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:53:12 +0200 Subject: [PATCH 16/16] Update --- azure-pipelines.yml | 2 -- node/toolrunner.ts | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a446b385f..5e87603a9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,8 +10,6 @@ variables: - group: npm-tokens - name: nodeVersion value: '16.13.0' -- name: ONEES_ENFORCED_CODEQL_ENABLED # Disable CodeQL - value: false resources: repositories: diff --git a/node/toolrunner.ts b/node/toolrunner.ts index e004982dd..6d01fa384 100644 --- a/node/toolrunner.ts +++ b/node/toolrunner.ts @@ -678,7 +678,9 @@ export class ToolRunner extends events.EventEmitter { if (fileStream) { fileStream.write(data); } - (cp.stdin?.write(data)); + if (!cp.stdin?.destroyed) { + 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.');