[Whonix-devel] Bug#856587: fake-tty shared object or command line tool
Patrick Schleizer
adrelanos at riseup.net
Thu Mar 2 19:07:00 CET 2017
Package: moreutils
Severity: whishlist
X-Debbugs-CC: whonix-devel at whonix.org
feature request:
fake-tty [application] - fools application into detecting being run
inside a tty
I am not a C coder, but at least a shared object looks easy to implement.
echo "int isatty(int fd) { return 1; }" | gcc -O2 -fpic -shared -ldl -o
"fake-tty.so" -xc -
usage:
LD_PRELOAD+=" fake-tty.so"
LD_PRELOAD="$LD_PRELOAD" apt-get "$@" 2>&1 | tee -a "$logfile"
(Preserves colors and download speed in terminal output that would
otherwise be eaten by using the pipe.)
use case:
1)
http://stackoverflow.com/questions/1401002/trick-an-application-into-thinking-its-stdin-is-interactive-not-a-pipe/26263980#26263980
python -c 'import pty, sys; pty.spawn(sys.argv[1:])' \
| apt-get "$@" 2>&1 \
| tee -a "$logfile"
2)
http://unix.stackexchange.com/questions/347970/how-to-create-a-real-copy-of-file-descriptor-stdout-and-stderr-without-using-unb
non-alternatives:
- script(1) man page says "It is not recommended to run script in
non-interactive shells.".
- unbuffer(1) does not correctly return the exit code if the process is
killed. Has a dependency on tcl.
Could you ship such fake-tty command line tool or shared object for
LD_PRELOAD with moreutils please?
Best regards,
Patrick
More information about the Whonix-devel
mailing list