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

Tasks/BashV3/_buildConfigs/Node20/package-lock.json

Lines changed: 220 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/BashV3/_buildConfigs/Node20/package.json

Lines changed: 1 addition & 1 deletion
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
},

Tasks/BashV3/bash.ts

Lines changed: 4 additions & 3 deletions
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.

Tasks/BashV3/package-lock.json

Lines changed: 48 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/BashV3/package.json

Lines changed: 1 addition & 1 deletion
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
},

Tasks/BashV3/task.json

Lines changed: 1 addition & 1 deletion
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.",

Tasks/BashV3/task.loc.json

Lines changed: 1 addition & 1 deletion
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",

Tasks/CmdLineV2/_buildConfigs/Node20/package-lock.json

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/CmdLineV2/_buildConfigs/Node20/package.json

Lines changed: 1 addition & 1 deletion
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": {

Tasks/CmdLineV2/cmdline.ts

Lines changed: 4 additions & 3 deletions
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.

0 commit comments

Comments
 (0)