Skip to content

Commit

Permalink
Script properly kills its co process now
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Teissier authored and Jean Teissier committed Jul 29, 2024
1 parent c5efe70 commit 96d60b5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions shell_buster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MINISHELL_PATH="./minishell"
TEST_COMMANDS="test_commands.txt"
TEMP_DIR="/tmp/shell_comparison"
TEMP_DIR="./shell_comparison"

mkdir -p "$TEMP_DIR"

Expand All @@ -14,6 +14,8 @@ do

bash -c "$cmd" > "$TEMP_DIR/bash_output" 2> "$TEMP_DIR/bash_error"

echo Coproc_ID $MINISHELL_PID
echo Parent_ID $$
echo "$cmd" >&${MINISHELL[1]}
read -r output <&${MINISHELL[0]}
echo "$output" > "$TEMP_DIR/minishell_output"
Expand All @@ -32,5 +34,6 @@ do

done < "$TEST_COMMANDS"

kill $COPROC_PID
rm -rf "$TEMP_DIR"
pkill -P $MINISHELL_PID
rm -rf $TEMP_DIR

0 comments on commit 96d60b5

Please sign in to comment.