diff options
author | Cassidy Burden <cburden@google.com> | 2016-06-16 14:46:18 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-06-17 10:40:13 -0700 |
commit | dcafebee1897d69f20282dc52082e1e5602cdbf0 (patch) | |
tree | 48c63f157da9005f4db1bf6814fc6c3560f105d7 /binary_search_tool | |
parent | 76c2be6cad46342f69ca5dd3d69f4f4d31f85de9 (diff) | |
download | toolchain-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-x | binary_search_tool/cros_pkg/cros_pkg_switch_to_bad.sh | 3 | ||||
-rwxr-xr-x | binary_search_tool/cros_pkg/cros_pkg_switch_to_good.sh | 3 |
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=$? |