cookbook/container/kvm: better handling of \r\n line endings.
This commit is contained in:
parent
1479189bfe
commit
938c6c65c4
1 changed files with 8 additions and 3 deletions
|
|
@ -21,10 +21,15 @@ kvm \
|
||||||
-serial chardev:char0 \
|
-serial chardev:char0 \
|
||||||
-serial chardev:char1 \
|
-serial chardev:char1 \
|
||||||
-serial chardev:char2 >&2
|
-serial chardev:char2 >&2
|
||||||
read rv <$1.code || true
|
fix_cr() {
|
||||||
[ -z "$rv" ] && exit 99
|
# serial devices use crlf (\r\n) as line
|
||||||
|
# endings instead of just lf (\n).
|
||||||
|
sed -e 's/\r//g'
|
||||||
|
}
|
||||||
|
rv=$(fix_cr <"$1.code")
|
||||||
|
[ -n "$rv" ] || exit 99
|
||||||
if [ "$rv" -eq 0 ]; then
|
if [ "$rv" -eq 0 ]; then
|
||||||
sed -e 's/\r//g' "$1.out" >$3
|
fix_cr <"$1.out" >$3
|
||||||
echo "ok." >&2
|
echo "ok." >&2
|
||||||
else
|
else
|
||||||
echo "kvm program returned error: $rv" >&2
|
echo "kvm program returned error: $rv" >&2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue