From f2d4a356d995c10748a62bd4f06916d6f29aa97e Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Thu, 4 Jan 2024 13:01:30 -0500 Subject: [PATCH] simplified valgrind wrapper --- opt/cs50/bin/valgrind | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/opt/cs50/bin/valgrind b/opt/cs50/bin/valgrind index 9536c2e..6a5350b 100755 --- a/opt/cs50/bin/valgrind +++ b/opt/cs50/bin/valgrind @@ -1,11 +1,9 @@ #!/bin/bash -# Don't run on Python programs -for arg; do - if echo "$arg" | grep -Eq "(^python|\.py$)"; then - echo "Afraid valgrind does not support Python programs!" - exit 1 - fi -done +# If run on Python program +if [[ "$1" == "python" || "$1" == *.py ]]; then + echo "Afraid valgrind does not support Python programs!" + exit 1 +fi -/usr/bin/valgrind $* +/usr/bin/valgrind "$@"