From bf19f94c0858170353c94448da91cf4b4b493c1e Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Mon, 29 Feb 2016 02:13:40 +0000 Subject: [PATCH] pass env variable better i think --- ...ariable TEST_SHELL should be passed through. | 2 +- urchin | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/Cross-shell testing/Environment variable TEST_SHELL should be passed through. b/tests/Cross-shell testing/Environment variable TEST_SHELL should be passed through. index ab030e6..019afd2 100755 --- a/tests/Cross-shell testing/Environment variable TEST_SHELL should be passed through. +++ b/tests/Cross-shell testing/Environment variable TEST_SHELL should be passed through. @@ -5,4 +5,4 @@ # Test if $TEST_SHELL, when placed in urchin's environment, is passed through to the test scripts. TEST_SHELL="$PWD/.special-shell" $TEST_SHELL \ - ../../urchin ./.test-TEST_SHELL-passed-through + ../../urchin --disable-cycling ./.test-TEST_SHELL-passed-through diff --git a/urchin b/urchin index 4dcadf1..af9daa4 100755 --- a/urchin +++ b/urchin @@ -144,15 +144,6 @@ recurse() { # Determine the environment variable to define for test scripts # that reflects the specified or implied shell to use for shell-code tests. while read the_test_shell; do - if test -z "$the_test_shell"; then - # Shell cycling is disabled with -n; use the present value of - # TEST_SHELL or default to /bin/sh - if [ -n "$TEST_SHELL" ]; then - the_test_shell="$TEST_SHELL" - else - the_test_shell=/bin/sh - fi - fi ( if test -f setup; then . ./setup; fi @@ -165,7 +156,13 @@ recurse() { TEST_SHELL="$the_test_shell" "$the_test_shell" \ "$potential_test" else - TEST_SHELL="$the_test_shell" "$potential_test" + # Shell cycling is disabled with -n; use the present value of + # TEST_SHELL or default to /bin/sh + if [ -n "$TEST_SHELL" ]; then + "$potential_test" + else + TEST_SHELL=/bin/sh "$potential_test" + fi fi } > "$(stdout_file "$potential_test" "$the_test_shell")" 2>&1 exit_code="$?"