
Hi, I just noticed this in my process list: │ ├─xmonad-x86_64-l │ │ └─sh -c gnome-terminal │ │ └─gnome-terminal and the reason is here, in Core.hs: -- | Like 'spawn', but returns the 'ProcessID' of the launched application spawnPID :: MonadIO m => String -> m ProcessID spawnPID x = io . forkProcess . finally nullStdin $ do uninstallSignalHandlers createSession executeFile "/bin/sh" False ["-c", x] Nothing where nullStdin = do fd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags dupTo fd stdInput closeFd fd Generally, this is of course useful. But I bet that most commands passed to spawn are simple program names without arguments or any fancy shell-related stuff. Executing a shell here seems overkill. Not much, but still avoidable. How about checking whether the argument x contains only alphanumerical characters and, if that is the case, executing the program directly? Such short-circuit logic is for example also used by perl’s sytem(), see perldoc -f system: If there is only one scalar argument, the argument is checked for shell metacharacters, and if there are any, the entire argument is passed to the system's command shell for parsing (this is "/bin/sh -c" on Unix platforms, but varies on other platforms). If there are no shell metacharacters in the argument, it is split into words and passed directly to "execvp", which is more efficient. Greetings, Joachim -- Joachim "nomeata" Breitner mail: mail@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C JID: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/ Debian Developer: nomeata@debian.org