waitForProcess error on startup

I've written a shell script that chooses which browser I would prefer to run based on what's available on my machine. In my xmonad.hs I use readProcess to get the name at startup, and then bind a key to running that name. On my Solaris machine, with an older GHC, this works perfectly, but on my Ubuntu machine with a newer GHC it gives an error at startup: xmonad-x86_64-linux: waitForProcess: does not exist (No child processes) Maybe it tries to get the pid of the child after launching the script but it executes too fast? Here's the snippet from xmonad.hs: main = do home_folder <- getEnv "HOME" editor <- getEditor browser_name <- (readProcess (joinPath [home_folder, "etc/utils/pick_best_browser"]) ["-n"] []) xmonad $ defaults editor home_folder ((head . lines) browser_name) The script when I run it gives this output: /usr/bin/chromium-browser And when I run it with the -n flag like I'm passing above: chromium-browser Which is exactly the output I expect. Since it all works fine on a another box I don't think it's anything wrong with the script -- I figured it could be an environment problem but it only relies on $HOME. Any ideas? Thanks, Joe G.

Joseph Garvin
Any ideas?
I'd recommend having the script run when you log in and set the BROWSER environment variable and then using that. Other tools look at $BROWSER to determine what to open links with (though it's nowhere near as prevalent as $EDITOR, it is around). --Ben

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2/13/11 19:21 , Joseph Garvin wrote:
xmonad-x86_64-linux: waitForProcess: does not exist (No child processes)
Different xmonad version? In particular, if you're running a recent darcs xmonad, there was a change to ignore all child processes (see SIGCHLD documentation), so things like readProcess won't work quite right. - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery.b@gmail.com system administrator [openafs,heimdal,too many hats] kf8nh -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1aACYACgkQIn7hlCsL25VZ2wCfYXN6qe/dLTX06226rs5wKtJk F/EAn0AuStDXtas0n3C/yLmKBlnhThdM =jRK7 -----END PGP SIGNATURE-----
participants (3)
-
Ben Boeckel
-
Brandon S Allbery KF8NH
-
Joseph Garvin