Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix identifying Sub-Processes #13

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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