-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
winpty: auto-detect redirects of stdin/stdout
Running commands through winpty with a redirected stdin or stdout only leads to error messages, that are at best not very helpfull to users and at worst outright confusing users. We can do better by adding a thin wrapper script that detects when it is and isn't appropriate to run a command through winpty and acts accordingly. Signed-off-by: Matthias Aßhauer <mha1993@live.de>
- Loading branch information
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
die () { | ||
echo "$*" >&2 | ||
exit 1 | ||
} | ||
|
||
test $# = 1 || | ||
die "Usage: $0 <command>" | ||
|
||
if [ -t 0 -a -t 1 ]; then | ||
exec winpty.exe "$@" | ||
else | ||
exec "$@" | ||
fi |