From 217433a25c3c4796bcb71da428febb57a44c9303 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Tue, 18 Dec 2012 16:56:53 -0700 Subject: [PATCH] Do not setsid() just because of --batch-mode. Commit 6b474c5 has turned --batch-mode into something like a --background option, ensuring that setsid() is called. Re-worked the logic so that tty interrupt characters are not frobbed in batch-mode AND setsid() is not called (except according to the curious but ancient heuristic/default: when there is no tty on stdin, stderr and stdout and no --emacs option). --- src/microcode/uxtop.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/microcode/uxtop.c b/src/microcode/uxtop.c index e8152afe0..da11c63f1 100644 --- a/src/microcode/uxtop.c +++ b/src/microcode/uxtop.c @@ -75,15 +75,11 @@ OS_initialize (void) { initialize_interruptable_extent (); { - if (option_force_interactive) - interactive = true; - else if (option_batch_mode) - interactive = false; - else - interactive - = ((isatty (STDIN_FILENO)) - || (isatty (STDOUT_FILENO)) - || (isatty (STDERR_FILENO))); + interactive = + (option_force_interactive + || (isatty (STDIN_FILENO)) + || (isatty (STDOUT_FILENO)) + || (isatty (STDERR_FILENO))); /* If none of the stdio streams is a terminal, disassociate us from the controlling terminal so that we're not affected by keyboard interrupts or hangup signals. However, if we're @@ -91,6 +87,8 @@ OS_initialize (void) to receive a hangup signal if Emacs dies. */ if ((!interactive) && (!option_emacs_subprocess)) UX_setsid (); + if (option_batch_mode) + interactive = false; /* The argument passed to `UX_ctty_initialize' says whether to permit interrupt control, i.e. whether to attempt to setup the keyboard interrupt characters. */ -- 2.25.1