Skip to content

Commit 751a9c4

Browse files
authored
Inline runner.sh (#768)
* in the middle * Inline runner * Add bug * uncomment * comment out bug * comment
1 parent e700ba1 commit 751a9c4

File tree

3 files changed

+13
-143
lines changed

3 files changed

+13
-143
lines changed

evaluation/tests/interface_tests/run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@ test_IFS()
348348
$shell test-IFS.sh
349349
}
350350

351+
test_shell_args()
352+
{
353+
local shell=$1
354+
$shell -c "echo hi" -x 2>&1
355+
}
356+
351357
run_test test1
352358
run_test test2
353359
run_test test3
@@ -391,6 +397,7 @@ run_test test_star
391397
run_test test_env_vars
392398
run_test test_redir_dup
393399
run_test test_IFS
400+
# run_test test_shell_args # Bug that needs to be fixed with arg parsing
394401

395402
if type lsb_release >/dev/null 2>&1 ; then
396403
distro=$(lsb_release -i -s)

pa.sh

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ kill_all() {
1515
old_umask=$(umask)
1616
umask u=rwx,g=rx,o=rx
1717

18-
## Handle --init early exit
19-
if [ "$#" -eq 1 ] && [ "$1" = "--init" ]; then
20-
"$PASH_TOP"/compiler/superoptimize.sh
21-
exit
22-
fi
23-
24-
## Check Python availability
25-
if ! command -v python3 &> /dev/null; then
26-
echo "Python >=3 could not be found"
27-
exit 1
28-
fi
29-
3018
## Get bash version for pash
3119
export PASH_BASH_VERSION="${BASH_VERSINFO[@]:0:3}"
3220

@@ -343,16 +331,13 @@ PASH_FROM_SH="PaSh preprocessor" "$PASH_TOP/python_pkgs/bin/python" \
343331
"$PASH_TOP/compiler/pash_preprocessor.py" "${preprocessor_args[@]}"
344332
pash_exit_code=$?
345333

346-
## If preprocessing succeeded, execute with runner.sh
334+
## If preprocessing succeeded, execute the preprocessed script
347335
if [ "$pash_exit_code" -eq 0 ]; then
348-
"$PASH_TOP/runtime/runner.sh" \
349-
"$preprocessed_output" \
350-
"$shell_name" \
351-
"${script_args[@]}" \
352-
$allexport_flag \
353-
$verbose_flag \
354-
$xtrace_flag \
355-
--debug "$PASH_DEBUG_LEVEL"
336+
## The underlying shell needs to be invoked correctly
337+
## with all shell-specific arguments.
338+
bash_flags="$allexport_flag $verbose_flag $xtrace_flag"
339+
# shellcheck disable=SC2086
340+
bash $bash_flags -c "source $preprocessed_output" "$shell_name" "${script_args[@]}"
356341
pash_exit_code=$?
357342
fi
358343

runtime/runner.sh

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)