summaryrefslogtreecommitdiffstats
path: root/envsetup.sh
diff options
context:
space:
mode:
authorMarcos Marado <mmarado@cyngn.com>2015-01-13 15:14:28 +0000
committerAdnan Begovic <adnan@cyngn.com>2015-10-06 18:43:35 -0700
commit37e92c2fe7310ceae1a0d65e44c2309adb5789bd (patch)
treea659629656e95bc28c78f6b740dfbae49eafb4b3 /envsetup.sh
parentb9e382f2d0a54f50e348968353b6ecf30a9bf8dc (diff)
downloadbuild-37e92c2fe7310ceae1a0d65e44c2309adb5789bd.zip
build-37e92c2fe7310ceae1a0d65e44c2309adb5789bd.tar.gz
build-37e92c2fe7310ceae1a0d65e44c2309adb5789bd.tar.bz2
dopush only tries to push if its arg doesn't fail
`dopush mm`, as an example, tried to do mm, ignored its result, and went to push. Now, it does mm, and if mm exits successfully it continues to push the results, but if mm fails dopush stops, returning mm's return code. This is useful for having things like: $ mmp && adb reboot which now reboot the device weather the changes were pushed or not. With this patch, the device will only get rebooted if the compilation succeeds. Change-Id: I001e3dd83e25a775919adbccbd49914da1e94cde
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 314a539..a0dbf3d 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -2171,7 +2171,11 @@ function dopush()
adb remount &> /dev/null
mkdir -p $OUT
- $func $* | tee $OUT/.log
+ ($func $*|tee $OUT/.log;return ${PIPESTATUS[0]})
+ ret=$?;
+ if [ $ret -ne 0 ]; then
+ rm -f $OUT/.log;return $ret
+ fi
# Install: <file>
LOC="$(cat $OUT/.log | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | grep '^Install: ' | cut -d ':' -f 2)"