[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 -


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:


python -c 'import pty, sys; pty.spawn(sys.argv[1:])' \
   | apt-get "$@" 2>&1 \
   | tee -a "$logfile"



- 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,

More information about the Whonix-devel mailing list