]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
CloseOnExit now defaults to COE_ALWAYS for pterm, bringing it back
authorSimon Tatham <anakin@pobox.com>
Mon, 28 Oct 2002 17:39:21 +0000 (17:39 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 28 Oct 2002 17:39:21 +0000 (17:39 +0000)
into line with most other xtermalikes. On Unix, the exit code of a
shell is the last exit code of one of its child processes, even if
it's an interactive shell - so some pterms will close and some will
not for no particularly good reason. Power-detaching a screen
session is especially bad for this.
COE_NORMAL is still useful for specialist purposes (running a single
command in its own pterm), but I don't think it's a sane default,
unfortunately.

git-svn-id: http://svn.tartarus.org/sgt/putty@2154 cda61777-01e9-0310-a592-d414129be87e

settings.c
unix/pterm.1

index 71ae49e4d90d28cc10a2ca55a9d4684fd59d237e..736d6775fa25af0de2f494db7a7c9550a1165b5b 100644 (file)
@@ -349,7 +349,23 @@ void load_settings(char *section, int do_host, Config * cfg)
            break;
        }
 
-    gppi(sesskey, "CloseOnExit", COE_NORMAL, &cfg->close_on_exit);
+    /*
+     * CloseOnExit defaults to closing only on a clean exit - but
+     * unfortunately not on Unix (pterm). On Unix, the exit code of
+     * a shell is the last exit code of one of its child processes,
+     * even if it's an interactive shell - so some pterms will
+     * close and some will not for no particularly good reason. The
+     * mode is still useful for specialist purposes (running a
+     * single command in its own pterm), but I don't think it's a
+     * sane default, unfortunately.
+     */
+    gppi(sesskey, "CloseOnExit",
+#ifdef _WINDOWS
+         COE_NORMAL,
+#else
+         COE_ALWAYS,
+#endif
+         &cfg->close_on_exit);
     gppi(sesskey, "WarnOnClose", 1, &cfg->warn_on_close);
     {
        /* This is two values for backward compatibility with 0.50/0.51 */
index 2e57f62430a7fe77c3bb6801812613e5248a8255..16436158ae84a4e15cfc9adf722fc26361059483 100644 (file)
@@ -110,15 +110,15 @@ for some FOO; you can make \fIpterm\fP look them up under another
 name, such as \fIxyz.FOO\fP, by specifying the command-line option
 "-name xyz".
 .IP "\fBpterm.CloseOnExit\fP"
-This option should be set to 0, 1 or 2; the default is 1. It
+This option should be set to 0, 1 or 2; the default is 2. It
 controls what \fIpterm\fP does when the process running inside it
-terminates. When set to 2, \fIpterm\fP will close its window as soon
-as the process inside it terminates. When set to 0, \fIpterm\fP will
-print the process's exit status, and the window will remain present
-until a key is pressed (allowing you to inspect the scrollback, and
-copy and paste text out of it).
+terminates. When set to 2 (the default), \fIpterm\fP will close its
+window as soon as the process inside it terminates. When set to 0,
+\fIpterm\fP will print the process's exit status, and the window
+will remain present until a key is pressed (allowing you to inspect
+the scrollback, and copy and paste text out of it).
 
-When this setting is set to 1 (the default), \fIpterm\fP will close
+When this setting is set to 1, \fIpterm\fP will close
 immediately if the process exits cleanly (with an exit status of
 zero), but the window will stay around if the process exits with a
 non-zero code or on a signal. This enables you to see what went