From 0404623d51f7a5d71e550439f9cd3a3c2827f887 Mon Sep 17 00:00:00 2001 From: Esa Lakaniemi Date: Thu, 18 Oct 2012 20:31:08 +0300 Subject: [PATCH 1/2] Update src/cdm-xlaunch Replaced nohup with setsid: If using nohup, launching X from the first terminal will succeed but cdm will then shortly proceed to kill the process afterward. This problem is completely fixed by using setsid. --- src/cdm-xlaunch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdm-xlaunch b/src/cdm-xlaunch index 8ec7c14..e6b4986 100755 --- a/src/cdm-xlaunch +++ b/src/cdm-xlaunch @@ -77,7 +77,7 @@ if $consolekit; then fi # Conform to POSIX and do not use `>&' here. -nohup startx $* > /dev/null 2>&1 & +setsid startx $* > /dev/null 2>&1 & # If wait(1) returns with a value >128, it was interrupted by kill(1), # so registration was sucessful. From 06a8406bbf829ec9d47a3e7c74bfa1fe110a3268 Mon Sep 17 00:00:00 2001 From: Esa Lakaniemi Date: Thu, 18 Oct 2012 20:38:42 +0300 Subject: [PATCH 2/2] Untrap before calling console programs At least bash refuses to let you untrap signals that have been trapped by a parent process. Not untrapping it here means effectively and unrevokably disabling ^C in any child process of any child bash shell. It's irritating and confusing and probably not intended to happen. --- src/cdm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cdm b/src/cdm index d35bd98..2f13095 100755 --- a/src/cdm +++ b/src/cdm @@ -125,6 +125,12 @@ case ${flaglist[$binindex]} in # loop. To solve this problem, export $CDM_SPAWN when `exec'ing $bin and # only let the shell automatically `exec' cdm when $CDM_SPAWN is not set. # See also the example shell profile file shipped with the cdm package. + + # Also untrap SIGINT and SIGTSTP before spawning process: If this is not + # done, *ANY* child process of *ANY* child (bash) shell will completely + # ignore SIGINT, which is rather confusing, and cannot be undone. + + trap - SIGINT SIGTSTP CDM_SPAWN=$$ exec $bin ;;