aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool
diff options
context:
space:
mode:
authorCassidy Burden <cburden@google.com>2016-06-16 14:46:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-06-17 10:40:13 -0700
commitdcafebee1897d69f20282dc52082e1e5602cdbf0 (patch)
tree48c63f157da9005f4db1bf6814fc6c3560f105d7 /binary_search_tool
parent76c2be6cad46342f69ca5dd3d69f4f4d31f85de9 (diff)
downloadtoolchain-utils-dcafebee1897d69f20282dc52082e1e5602cdbf0.tar.gz
Fix cros_pkg switch scripts so last input is properly read
When using --file_args the last line of input won't have a newline. This commit fixes the switch scripts so that read doesn't finish before reading the last line. Change-Id: Ia180ca2c26a40d6d0dafdb53d9129f3079e79a1b Reviewed-on: https://chrome-internal-review.googlesource.com/265085 Commit-Ready: Cassidy Burden <cburden@google.com> Tested-by: Cassidy Burden <cburden@google.com> Reviewed-by: Caroline Tice <cmtice@google.com> Reviewed-by: Han Shen <shenhan@google.com>
Diffstat (limited to 'binary_search_tool')
-rwxr-xr-xbinary_search_tool/cros_pkg/cros_pkg_switch_to_bad.sh3
-rwxr-xr-xbinary_search_tool/cros_pkg/cros_pkg_switch_to_good.sh3
2 files changed, 4 insertions, 2 deletions
diff --git a/binary_search_tool/cros_pkg/cros_pkg_switch_to_bad.sh b/binary_search_tool/cros_pkg/cros_pkg_switch_to_bad.sh
index f206cb89..8f07bf30 100755
--- a/binary_search_tool/cros_pkg/cros_pkg_switch_to_bad.sh
+++ b/binary_search_tool/cros_pkg/cros_pkg_switch_to_bad.sh
@@ -18,7 +18,8 @@ overall_status=0
if [[ -f ${PKG_LIST_FILE} ]] ; then
- while read pkg
+ # Read every line, and handle case where last line has no newline
+ while read pkg || [[ -n "$pkg" ]];
do
sudo cp ${BAD_BUILD}/packages/$pkg ${WORK_BUILD}/packages/$pkg
status=$?
diff --git a/binary_search_tool/cros_pkg/cros_pkg_switch_to_good.sh b/binary_search_tool/cros_pkg/cros_pkg_switch_to_good.sh
index cd4c2ed6..3d64d25a 100755
--- a/binary_search_tool/cros_pkg/cros_pkg_switch_to_good.sh
+++ b/binary_search_tool/cros_pkg/cros_pkg_switch_to_good.sh
@@ -18,7 +18,8 @@ overall_status=0
if [[ -f ${PKG_LIST_FILE} ]] ; then
- while read pkg
+ # Read every line, and handle case where last line has no newline
+ while read pkg || [[ -n "$pkg" ]];
do
sudo cp ${GOOD_BUILD}/packages/$pkg ${WORK_BUILD}/packages/$pkg
status=$?