diff --git a/CHANGELOG.md b/CHANGELOG.md index 01ae661..b47b08e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/Processes.php b/src/Processes.php index 51d14f3..761d521 100644 --- a/src/Processes.php +++ b/src/Processes.php @@ -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) && ( diff --git a/tests/ProcessesTest.php b/tests/ProcessesTest.php index 5ea6ad7..c3a3298 100644 --- a/tests/ProcessesTest.php +++ b/tests/ProcessesTest.php @@ -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(