Skip to content

Commit

Permalink
Add signal handling to BashV3, CmdLineV2 tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanduplenskikh committed Dec 10, 2024
1 parent 75ecf01 commit d61d6bf
Show file tree
Hide file tree
Showing 38 changed files with 730 additions and 482 deletions.
328 changes: 220 additions & 108 deletions Tasks/BashV3/_buildConfigs/Node20/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Tasks/BashV3/_buildConfigs/Node20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@types/mocha": "^9.1.1",
"@types/node": "^20.3.1",
"azure-pipelines-task-lib": "^4.16.0",
"azure-pipelines-task-lib": "^4.17.3",
"azure-pipelines-tasks-utility-common": "^3.230.0",
"uuid": "^3.0.1"
},
Expand Down
7 changes: 4 additions & 3 deletions Tasks/BashV3/bash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ async function run() {
ignoreReturnCode: true
};

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

// Listen for stderr.
Expand Down
96 changes: 48 additions & 48 deletions Tasks/BashV3/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Tasks/BashV3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@types/mocha": "^9.1.1",
"@types/node": "^16.18.105",
"azure-pipelines-task-lib": "^4.16.0",
"azure-pipelines-task-lib": "^4.17.3",
"azure-pipelines-tasks-utility-common": "^3.230.0",
"uuid": "^3.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion Tasks/BashV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 246,
"Minor": 250,
"Patch": 0
},
"releaseNotes": "Script task consistency. Added support for multiple lines and added support for Windows.",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/BashV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 246,
"Minor": 250,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down
11 changes: 6 additions & 5 deletions Tasks/CmdLineV2/_buildConfigs/Node20/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tasks/CmdLineV2/_buildConfigs/Node20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@types/mocha": "^8.0.3",
"@types/node": "^20.3.1",
"@types/uuid": "^8.3.0",
"azure-pipelines-task-lib": "^4.15.0",
"azure-pipelines-task-lib": "^4.17.3",
"uuid": "^8.3.0"
},
"devDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions Tasks/CmdLineV2/cmdline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ async function run() {
});
}

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

// Run bash.
Expand Down
102 changes: 51 additions & 51 deletions Tasks/CmdLineV2/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Tasks/CmdLineV2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@types/mocha": "^8.0.3",
"@types/node": "^16.11.39",
"@types/uuid": "^8.3.0",
"azure-pipelines-task-lib": "^4.15.0",
"azure-pipelines-task-lib": "^4.17.3",
"uuid": "^8.3.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/CmdLineV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 246,
"Minor": 250,
"Patch": 0
},
"releaseNotes": "Script task consistency. Added support for multiple lines.",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/CmdLineV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 246,
"Minor": 250,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down
4 changes: 2 additions & 2 deletions _generated/BashV3.versionmap.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Default|3.246.0
Node20-225|3.246.1
Default|3.250.0
Node20-225|3.250.1
7 changes: 4 additions & 3 deletions _generated/BashV3/bash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ async function run() {
ignoreReturnCode: true
};

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

// Listen for stderr.
Expand Down
Loading

0 comments on commit d61d6bf

Please sign in to comment.