Process exits when program exits
Closed this issue · 2 comments
vilu commented
I would want to write a program that eventually will start a process and allow this process to continue after the program comes to an end.
I've tried this
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Shelly
example :: IO ()
example = let
cmd' = fromText "nohup"
args = ["python", "-m", "SimpleHTTPServer", "8000", "&"]
in
void $ shelly $ run cmd' args
When I close this program this is also closed. That's not the case if I were to run this nohup python -m SimpleHTTPServer 8000 &
in a terminal and then close that terminal.
What's the cause of this? Is it intentional? Is there any way I can get around this?
gregwebs commented
I think nohup has no effect outside a login shell?
You can try looking at the System.Process.createProcess docs for more clues as to how to launch an independent background process.
vilu commented
Ok, I will have a look there. Thanks for the help!