Skip to content

Commit

Permalink
Fix identifying Sub-Processes
Browse files Browse the repository at this point in the history
That need to be killed, when cancelling a running Process.
  • Loading branch information
otsch committed Jul 13, 2023
1 parent 0fd7ff7 commit 84a4cf7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.1] - 2022-06-22
## [0.1.2] - 2022-07-13
### Fixed
* Fix identifying Sub-Processes that need to be killed, when cancelling a running Process.

## [0.1.1] - 2022-06-22
### Fixed
* When the new content of the ppq index file was shorter than the old content, it wrote the new content starting from the beginning of the file and the part of the old content that was longer than the new content, remained at the end of the file. Fixed it be truncating the file before writing the new content.

Expand Down
2 changes: 1 addition & 1 deletion src/Processes.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static function isSubProcessOf(int $pid, string $command, int $parentPid,
{
$splitAtGtGt = explode('>>', $parentCommand);

$parentCommandWithoutOutputToFile = $splitAtGtGt[0];
$parentCommandWithoutOutputToFile = trim($splitAtGtGt[0]);

return ($parentCommand === 'sh -c ' . $command || $parentCommandWithoutOutputToFile === 'sh -c ' . $command) &&
(
Expand Down
1 change: 1 addition & 0 deletions tests/ProcessesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function (int $pid, string $command, int $parentPid, string $parentCommand, bool
[123, 'php foo.php', 125, 'sh -c php foo.php', false],
[123, 'php foo.php', 126, 'sh -c php foo.php', false],
[125, 'sh -c php foo.php', 123, 'php foo.php', false],
[123, 'php foo.php', 122, 'sh -c php foo.php >> /path/to/123.log 2>&1', true],
]);

it(
Expand Down

0 comments on commit 84a4cf7

Please sign in to comment.