From 9c5e5de999888c573eb59dfeb803e7cb2fb92985 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 26 Mar 2020 22:58:43 -0400 Subject: [PATCH] Disable stty in launchers if stdin is not a terminal --- package/darwin/dfhack | 6 ++++++ package/linux/dfhack | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/package/darwin/dfhack b/package/darwin/dfhack index 9ededf5d5..1c2c7a175 100755 --- a/package/darwin/dfhack +++ b/package/darwin/dfhack @@ -17,6 +17,12 @@ if ! test -f hack/quarantine-removed; then echo "quarantine flag removed on $(date); remove this file to re-run" > hack/quarantine-removed fi +if [ ! -t 0 ]; then + stty() { + return + } +fi + old_tty_settings=$(stty -g) DYLD_INSERT_LIBRARIES=./hack/libdfhack.dylib ./dwarfort.exe "$@" stty "$old_tty_settings" diff --git a/package/linux/dfhack b/package/linux/dfhack index 18ec69cb8..b63c3a253 100755 --- a/package/linux/dfhack +++ b/package/linux/dfhack @@ -48,6 +48,12 @@ $HOME/$RC to affect future DFHack installations: EOF fi +if [ ! -t 0 ]; then + stty() { + return + } +fi + # Save current terminal settings old_tty_settings=$(stty -g)