[SVN] r11601 (Support/lib)

Allan Odgaard mailinglist at textmate.org
Sun Jun 7 11:49:46 UTC 2009

• install smart SIGUSR1 handler

Previously we would kill everything in the process group of the controlled process, and therefor, we changed the pgid of that process — this was bad because that made the “native” killing of the launched command (from TextMate) fail to find offspring.

The new handler constructs a process tree and then from that, determines what the “active” process is (the rightmost/last leaf) then sends SIGINT only to this process (waits a bit, then sends SIGTERM, and moves on to SIGKILL).

It does not go up the tree, but if multiple processes are “stalling” this can be achieved by repeatedly sending SIGUSR1 (which translates to pressing ^C in the Executor controlled command output window). It sends “^C: «command»” to stderr of the command being killed, so the user should get nice feedback, also incase it is somehow determining the wrong active process, or if repeated uses of ^C is needed to fully terminate Executor.

A simple example of a process requiring repeated presses of ^C is:

   #!/usr/bin/env ruby -wKU

   fork { sleep 200 }
   fork { sleep 200 }


U   trunk/Support/lib/tm/process.rb

More information about the textmate-dev mailing list