Skip to content

Commit 696024b

Browse files
Add signal handling to BashV3, CmdLineV2 tasks (#20706)
1 parent ec8af01 commit 696024b

38 files changed

+730
-482
lines changed

Diff for: Tasks/BashV3/_buildConfigs/Node20/package-lock.json

+220-108
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Tasks/BashV3/_buildConfigs/Node20/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"dependencies": {
2121
"@types/mocha": "^9.1.1",
2222
"@types/node": "^20.3.1",
23-
"azure-pipelines-task-lib": "^4.16.0",
23+
"azure-pipelines-task-lib": "^4.17.3",
2424
"azure-pipelines-tasks-utility-common": "^3.230.0",
2525
"uuid": "^3.0.1"
2626
},

Diff for: Tasks/BashV3/bash.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ async function run() {
184184
ignoreReturnCode: true
185185
};
186186

187-
process.on("SIGINT", () => {
188-
tl.debug('Started cancellation of executing script');
189-
bash.killChildProcess();
187+
['SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGTERM', 'EXIT'].forEach((signal) => {
188+
process.on(signal, () => {
189+
bash.killChildProcess(signal as NodeJS.Signals);
190+
});
190191
});
191192

192193
// Listen for stderr.

Diff for: Tasks/BashV3/package-lock.json

+48-48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Tasks/BashV3/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"dependencies": {
2121
"@types/mocha": "^9.1.1",
2222
"@types/node": "^16.18.105",
23-
"azure-pipelines-task-lib": "^4.16.0",
23+
"azure-pipelines-task-lib": "^4.17.3",
2424
"azure-pipelines-tasks-utility-common": "^3.230.0",
2525
"uuid": "^3.0.1"
2626
},

Diff for: Tasks/BashV3/task.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 3,
20-
"Minor": 246,
20+
"Minor": 250,
2121
"Patch": 0
2222
},
2323
"releaseNotes": "Script task consistency. Added support for multiple lines and added support for Windows.",

Diff for: Tasks/BashV3/task.loc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 3,
20-
"Minor": 246,
20+
"Minor": 250,
2121
"Patch": 0
2222
},
2323
"releaseNotes": "ms-resource:loc.releaseNotes",

Diff for: Tasks/CmdLineV2/_buildConfigs/Node20/package-lock.json

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Tasks/CmdLineV2/_buildConfigs/Node20/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@types/mocha": "^8.0.3",
2121
"@types/node": "^20.3.1",
2222
"@types/uuid": "^8.3.0",
23-
"azure-pipelines-task-lib": "^4.15.0",
23+
"azure-pipelines-task-lib": "^4.17.3",
2424
"uuid": "^8.3.0"
2525
},
2626
"devDependencies": {

Diff for: Tasks/CmdLineV2/cmdline.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ async function run() {
5858
});
5959
}
6060

61-
process.on("SIGINT", () => {
62-
tl.debug('Started cancellation of executing script');
63-
bash.killChildProcess();
61+
['SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGTERM', 'EXIT'].forEach((signal) => {
62+
process.on(signal, () => {
63+
bash.killChildProcess(signal as NodeJS.Signals);
64+
});
6465
});
6566

6667
// Run bash.

Diff for: Tasks/CmdLineV2/package-lock.json

+51-51
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Tasks/CmdLineV2/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@types/mocha": "^8.0.3",
2121
"@types/node": "^16.11.39",
2222
"@types/uuid": "^8.3.0",
23-
"azure-pipelines-task-lib": "^4.15.0",
23+
"azure-pipelines-task-lib": "^4.17.3",
2424
"uuid": "^8.3.0"
2525
},
2626
"devDependencies": {

Diff for: Tasks/CmdLineV2/task.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 2,
20-
"Minor": 246,
20+
"Minor": 250,
2121
"Patch": 0
2222
},
2323
"releaseNotes": "Script task consistency. Added support for multiple lines.",

Diff for: Tasks/CmdLineV2/task.loc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 2,
20-
"Minor": 246,
20+
"Minor": 250,
2121
"Patch": 0
2222
},
2323
"releaseNotes": "ms-resource:loc.releaseNotes",

Diff for: _generated/BashV3.versionmap.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Default|3.246.0
2-
Node20-225|3.246.1
1+
Default|3.250.0
2+
Node20-225|3.250.1

Diff for: _generated/BashV3/bash.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ async function run() {
184184
ignoreReturnCode: true
185185
};
186186

187-
process.on("SIGINT", () => {
188-
tl.debug('Started cancellation of executing script');
189-
bash.killChildProcess();
187+
['SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGTERM', 'EXIT'].forEach((signal) => {
188+
process.on(signal, () => {
189+
bash.killChildProcess(signal as NodeJS.Signals);
190+
});
190191
});
191192

192193
// Listen for stderr.

0 commit comments

Comments
 (0)