azure-pipelines-task-lib: ToolRunner.killChildProcess() unexpectedly sends SIGTERM instead of SIGINT

Environment

azure-pipelines-task-lib version: 3.3.1

Issue Description

The method ToolRunner.killChildProcess() is documented as follows:

/**
 * Used to close child process by sending SIGNINT signal.
 * It allows executed script to have some additional logic on SIGINT, before exiting.
 */

However, its implementation forwards without arguments to Node’s ChildProcess.kill() method (documented here) which by default sends SIGTERM to the child process unless a specific signal is specified.

This leads to unexpected behavior for scripts in downstream BashV3 pipeline task, where script tasks will receive SIGTERM instead of SIGINT.

The bug was introduced with https://github.com/microsoft/azure-pipelines-task-lib/pull/663 the intent of which was to add functionality for killing child processes.

Fixing a related incorrect behavior in BashV3 requires changes both here and in the downstream azure-pipelines-tasks library so I will create issues (and PRs) in both repos and update in both places to cross-reference.

Expected behaviour

The ToolRunner.killChildProcess() method should have a parameter allowing caller to specify which signal should be sent to the child process. If undefined, the method should default to SIGINT as per its docs and to ensure this is a non-breaking change.

Actual behaviour

The ToolRunner.killChildProcess() method implicitly sends SIGTERM to child process.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 19 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @DaRosenberg, thank you for creating an issue. We’re currently working on the more prioritized tickets. We’ll take a look at it once we have enough capacity.