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 race condition on process executing too fast #6

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

Baptouuuu
Copy link
Member

Problem

Right after starting a process we access its status to retrieve its PID. However if the process already finished before accessing the PID then this first call will also return the exit code. This means that when we try to retrieve the exit code when accessing the output then the reported exit code is -1 indicating it has always been provided in an earlier call.

Solution

When accessing the status of the process the exit code is cached in a property . If the value is cached it then overwrite any following value return when accessing the status.

@Baptouuuu Baptouuuu added the bug Something isn't working label Sep 18, 2024
@Baptouuuu Baptouuuu self-assigned this Sep 18, 2024
@Baptouuuu Baptouuuu merged commit 802a388 into develop Sep 18, 2024
26 checks passed
@Baptouuuu Baptouuuu deleted the fix-race-condition branch September 18, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant