summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet <dominique.martinet@cea.fr>2020-05-24 10:58:20 +0200
committerDominique Martinet <dominique.martinet@cea.fr>2020-05-24 11:00:06 +0200
commit56be3c4226302defe482861ae1d04eb1487112e9 (patch)
tree7f5ce817e41df5c9a026899fad60ddc5960adba4
parentd612fb1ceed5df73690685afa9135d5a4f90a7f0 (diff)
condition stty suggestion to having a tty
-rwxr-xr-xkvm-wrapper.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/kvm-wrapper.sh b/kvm-wrapper.sh
index 0038256..b212ba2 100755
--- a/kvm-wrapper.sh
+++ b/kvm-wrapper.sh
@@ -1030,7 +1030,7 @@ function kvm_serial ()
! test_exist "$PID_FILE" && fail_exit "Error: $VM_NAME doesn't seem to be running."
! test_socket_rw "$SERIAL_FILE" && fail_exit "Error: could not open serial socket $SERIAL_FILE."
echo "Attaching serial console unix socket (using socat)." >&2
- echo "You might want to run this after logging in: $(stty -a | awk '/rows/ { print "stty rows " $5 " cols "$7 }' | tr -d ';')" >&2
+ tty >/dev/null 2>&1 && echo "You might want to run this after logging in: $(stty -a | awk '/rows/ { print "stty rows " $5 " cols "$7 }' | tr -d ';')" >&2
echo "Press ^] to exit" >&2
local socatin="-"
tty >/dev/null 2>&1 && socatin="-,IGNBRK=0,BRKINT=0,PARMRK=0,ISTRIP=0,INLCR=0,IGNCR=0,ICRNL=0,IXON=0,OPOST=1,ECHO=0,ECHONL=0,ICANON=0,ISIG=0,IEXTEN=0,CSIZE=0,PARENB=0,CS8,escape=0x1d"