diff --git a/shell_buster.sh b/shell_buster.sh index 0113bb3..a264135 100755 --- a/shell_buster.sh +++ b/shell_buster.sh @@ -7,6 +7,7 @@ TEMP_DIR="./shell_comparison" mkdir -p "$TEMP_DIR" coproc MINISHELL { "$MINISHELL_PATH"; } +sleep 1 while IFS= read -r cmd do @@ -14,19 +15,22 @@ 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]} + echo >&${MINISHELL[1]} + sleep 0.5 + + read -r echoed_cmd <&${MINISHELL[0]} + sleep 0.5 + read -r output <&${MINISHELL[0]} echo "$output" > "$TEMP_DIR/minishell_output" - + echo "Bash output:" + cat "$TEMP_DIR/bash_output" + echo "Minishell output:" + cat "$TEMP_DIR/minishell_output" if ! diff -q "$TEMP_DIR/bash_output" "$TEMP_DIR/minishell_output" >/dev/null then echo "Difference in stdout for command: $cmd" - echo "Bash output:" - cat "$TEMP_DIR/bash_output" - echo "Minishell output:" - cat "$TEMP_DIR/minishell_output" echo "Diff:" diff "$TEMP_DIR/bash_output" "$TEMP_DIR/minishell_output" echo diff --git a/test_commands.txt b/test_commands.txt index ff0e12e..1434399 100644 --- a/test_commands.txt +++ b/test_commands.txt @@ -1 +1,2 @@ -echo Hello World +echo "HELLO WORLD" +echo Hello World What