← Back to context

Comment by benjacksondev

3 hours ago

Hey PopGreene, initially, `$child_pid` was set, but I refactored to use `$!` throughout instead. It must have been an oversight when I refactored `$child_pid` out, as the script still passes with the `$child_pid` not set. This is because running `wait` without an argument exits successfully. With `$child_pid` no longer set, it should be replaced with `$!`; otherwise, the script does not wait until the child process is terminated.

To clarify, the `wait` is there to avoid zombie processes, which is the script's intention; it should not be `$child_pid` but instead `$!`.

I've amended the post; thank you.