Skip to content

Commit

Permalink
Correctly handle multi-line output, previously was only reading the f…
Browse files Browse the repository at this point in the history
…irst line
  • Loading branch information
Richard Heelin committed May 19, 2015
1 parent ac44a83 commit 9bae1ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cronlock
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ function cmd {
\$*) # Bulk reply
nchars="$(echo "${response#\$}"| tr -d '\n\r\0\t')"
nchars="$(echo "${nchars%\r}"| tr -d '\n\r\0\t')"
read -n $nchars response <&3
IFS= read -r -n $nchars -d '' response <&3
echo $response
read -t 1 -r response <&3 # Clear any remaining newlines
;;
*) # net yet handled
echo "ERR - Unknown response\n" >&2
echo "ERR - Unknown response" >&2
info "${response}" >&2
exit 201
;;
esac
Expand Down

0 comments on commit 9bae1ab

Please sign in to comment.