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

[11.x] Check if the running Symfony process has timed out #54903

Closed
wants to merge 1 commit into from

Conversation

mattmcdev
Copy link
Contributor

This fix checks for timeouts when a process is running.

Consider the following example from the documentation:

$process = Process::timeout(120)->start('bash import.sh');
 
// ...
 
$result = $process->wait();

This uses the wait method from Symfony's Process which includes a call to checkTimeout that throws ProcessTimedOutException which the framework catches and reports back.

Compared to this example from the documentation:

$process = Process::timeout(120)->start('bash import.sh');
 
while ($process->running()) {
    // ...
}
 
$result = $process->wait();

This uses the isRunning method from Symfony's Process which doesn't ever call checkTimeout. The loop will never catch any timeouts.

If this change is too breaking, maybe instead exposing the checkTimeout method and adding a note to the docs so developers know to make this check themselves in their while loop ?

@taylorotwell
Copy link
Member

Do indeed worry this is a breaking change.

@mattmcdev mattmcdev deleted the fix-process-check-timeout branch March 6, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants