summaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-10-19 19:16:28 -0700
committerMichael Pavone <pavone@retrodev.com>2015-10-19 19:16:28 -0700
commitda5249a364aac3ec1b6d28dd7200cf6cdd9a2913 (patch)
treee7edeec1163420ca06c59eacc88917fa72c8d110 /terminal.c
parent70a4bf6d6b7c79c936e96fc8e3cceb96c125695a (diff)
Added a command line option to force BlastEm to not open a new terminal even if it detects that stdin/out are not terminals
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c12
1 files changed, 9 insertions, 3 deletions
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;
}
}