SafeSystem.safeSystem executes a command (supplied as a String) and returns its exit code. It differs from System.system in that it does NOT stop the world while doing this, so that other threads can run. How it works: we use ChildProcess to run the runCommand C program, and feed it the command over stdin. Ugly, but is there a better way?
Documentation
safeSystemGeneral :: String -> (String -> IO ()) -> IO ExitCodeSource
Run "command", displaying any output using the supplied outputSink function. (This output had better not include "EXITCODE [number]".)
outputSink is fed output line by line, and without the newlines.
safeSystem :: String -> IO ExitCodeSource