Skip to content

Instantly share code, notes, and snippets.

@imaami
Created July 5, 2020 11:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imaami/576a5581e7e3df07d6ecf181bd2e16ea to your computer and use it in GitHub Desktop.
Save imaami/576a5581e7e3df07d6ecf181bd2e16ea to your computer and use it in GitHub Desktop.
Trick programs into thinking they're piping to an interactive terminal
/**
* Overrides the glibc function. Will always return true.
*
* Note: Although this should be ok for most applications it can
* lead to unwanted side effects. It depends on the question
* why the programm calls isatty()
*
* Compiling
*
* $ gcc -s -fpic -shared -o libtricktty.so trick_tty.c
*
* Installing
*
* # cp libtricktty.so /usr/local/lib/
*
* Usage
*
* $ alias trick_tty='LD_PRELOAD=/usr/local/lib/libtricktty.so'
* $ trick_tty <command>
*
* From https://stackoverflow.com/a/14694983
*/
int isatty (int param __attribute__((__unused__)))
{
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment