From da5249a364aac3ec1b6d28dd7200cf6cdd9a2913 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Mon, 19 Oct 2015 19:16:28 -0700 Subject: Added a command line option to force BlastEm to not open a new terminal even if it detects that stdin/out are not terminals --- terminal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 0e952f2..aace0f2 100644 --- a/terminal.c +++ b/terminal.c @@ -17,9 +17,15 @@ void cleanup_terminal() unlink(OUTPUT_PATH); } +static char init_done; + +void force_no_terminal() +{ + init_done = 1; +} + void init_terminal() { - static char init_done; if (!init_done) { if (!(isatty(STDIN_FILENO) && isatty(STDOUT_FILENO))) { #ifndef __APPLE__ @@ -32,7 +38,7 @@ void init_terminal() //create FIFOs for talking to helper process in terminal app mkfifo(INPUT_PATH, 0666); mkfifo(OUTPUT_PATH, 0666); - + //close existing file descriptors close(STDIN_FILENO); close(STDOUT_FILENO); @@ -59,7 +65,7 @@ void init_terminal() } } } - + init_done = 1; } } -- cgit v1.2.3