Merge commit '36c66dd290d3ce6eb1ccd310d0c658d4a32bb8eb' as 'repos/effect'
This commit is contained in:
32
repos/effect/packages/platform-node-shared/test/fixtures/bash/spawn-children.sh
vendored
Executable file
32
repos/effect/packages/platform-node-shared/test/fixtures/bash/spawn-children.sh
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script spawns child processes to test process group cleanup
|
||||
echo "Parent process started with PID $$"
|
||||
|
||||
# Spawn multiple child processes
|
||||
for i in {1..3}; do
|
||||
(
|
||||
# Child process
|
||||
child_pid=$BASHPID
|
||||
echo "Child $i started with PID $child_pid"
|
||||
|
||||
# Spawn a grandchild that runs for a long time
|
||||
(
|
||||
grandchild_pid=$BASHPID
|
||||
echo "Grandchild of child $i started with PID $grandchild_pid"
|
||||
# Keep running for 60 seconds
|
||||
for j in {1..60}; do
|
||||
sleep 1
|
||||
done
|
||||
) &
|
||||
|
||||
# Keep the child running
|
||||
for j in {1..60}; do
|
||||
sleep 1
|
||||
done
|
||||
) &
|
||||
done
|
||||
|
||||
# Keep the parent running
|
||||
echo "Parent process waiting..."
|
||||
wait
|
||||
Reference in New Issue
Block a user