summaryrefslogtreecommitdiff
path: root/hints
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2013-08-09 06:39:49 -0300
committerBrian Fraser <fraserbn@gmail.com>2014-01-26 14:44:20 -0300
commit8995f03f98085ffc6f8f1458d5d32bcb87ed7964 (patch)
tree8e6145d6597520ca2a2251c97bd62c08deead2e8 /hints
parent13c14f5c8d5727459ceb9f782250be271ddedc7e (diff)
downloadperl-8995f03f98085ffc6f8f1458d5d32bcb87ed7964.tar.gz
hints/linux-androideabi.sh: Rather than relaying on adb, save the exit status in a file and then copy it over
Diffstat (limited to 'hints')
-rw-r--r--hints/linux-android.sh27
1 files changed, 20 insertions, 7 deletions
diff --git a/hints/linux-android.sh b/hints/linux-android.sh
index 7acefdee31..8566f62b4e 100644
--- a/hints/linux-android.sh
+++ b/hints/linux-android.sh
@@ -145,7 +145,7 @@ from=$from-$targetfrom
cat >$run <<EOF
#!/bin/sh
-doexit="echo \\\$?"
+doexit="echo \\\$? >$targetdir/output.status"
env=''
case "\$1" in
-cwd)
@@ -174,16 +174,29 @@ $to \$exe > /dev/null 2>&1
# send copy results to /dev/null as otherwise it outputs speed stats which gets in our way.
# sometimes there is no $?, I dunno why? we then get Cross/run-adb-shell: line 39: exit: XX: numeric argument required
-foo=\`adb -s $targethost shell "sh -c '(cd \$cwd && \$env ; \$exe \$args) > $targetdir/output.stdout ; \$doexit '"\`
-# We get back Ok\r\n on android for some reason, grrr:
+adb -s $targethost shell "sh -c '(cd \$cwd && \$env ; \$exe \$args > $targetdir/output.stdout 2>$targetdir/output.stderr) ; \$doexit '" > /dev/null
+
$from output.stdout
+$from output.stderr
+$from output.status
+
result=\`cat output.stdout\`
-rm output.stdout
+result_err=\`cat output.stderr\`
+result_status=\`cat output.status\`
+rm output.stdout output.stderr output.status
+
+# We get back Ok\r\n on android for some reason, grrr:
result=\`echo "\$result" | sed -e 's|\r||g'\`
-foo=\`echo \$foo | sed -e 's|\r||g'\`
-# Also, adb doesn't exit with the commands exit code, like ssh does, double-grr
+result_err=\`echo "\$result_err" | sed -e 's|\r||g'\`
+result_status=\`echo \$result_status | sed -e 's|\r||g'\`
+
echo "\$result"
-exit \$foo
+if test "X\$result_err" != X; then
+ echo "\$result_err" >&2
+fi
+
+# Also, adb doesn't exit with the commands exit code, like ssh does, double-grr
+exit \$result_status
EOF
chmod a+rx $run