I am currently writing a Haskell program that does some initialization work and then calls ncmpcpp. What I am trying to do is start ncmpcpp and terminate the Haskell program, so that only ncmpcpp is left (optionally, the program can keep running in the background, as long as it's unintrusive)
However, even though I am able to start ncmpcpp, I cannot interact with it. I see its output, but input appears to be impossible.
What I am currently doing is:
import System.Process (createProcess, proc)
...
spawnCurses :: [String] -> IO ()
spawnCurses params = do
_ <- createProcess (proc "ncmpcpp" params)
return ()
What am I doing wrong/What should I do differently?
What you are trying to achieve sounds like what the exec
family of functions does. Take a look at the executeFile
function.
If you want your parent Haskell process to be still running after the child process is started read about fork-exec and the forkProcess
function.
A complete example of using forkProcess
together with executeFile
can be found at http://therning.org/magnus/archives/727.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With