6

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?

1 Answer 1

6

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.