Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar | Owner: simonmar Type: task | Status: new Priority: normal | Milestone: _|_ Component: libraries/process | Version: 6.8.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown|Testcase: Blockedby: |Blocking: Related: | --+- Comment(by benmachine): Now that it's been another 2 years, the haddock link above is dead. Does anyone know what the new signal API referred to? Is it worth keeping this bug open? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar | Owner: simonmar Type: task | Status: new Priority: normal | Milestone: _|_ Component: libraries/process | Version: 6.8.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown|Testcase: Blockedby: |Blocking: Related: | --+- Comment(by simonmar): The new signal API is #2451. That ran into problems IIRC. We probably still want this API change, but probably not the signal changes, so I'll keep the ticket open. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar | Owner: simonmar Type: task | Status: new Priority: normal | Milestone: _|_ Component: libraries/process | Version: 6.8.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown|Testcase: Blockedby: |Blocking: Related: | --+- Changes (by simonmar): * milestone: 7.4.1 = _|_ -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar |Owner: simonmar Type: task | Status: new Priority: normal |Milestone: 7.4.1 Component: libraries/process | Version: 6.8.2 Keywords: | Testcase: Blockedby: | Difficulty: Unknown Os: Unknown/Multiple | Blocking: Architecture: Unknown/Multiple | Failure: None/Unknown --+- Changes (by igloo): * milestone: Not GHC = 7.4.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar |Owner: simonmar Type: task | Status: new Priority: normal |Milestone: Not GHC Component: libraries/process | Version: 6.8.2 Keywords: | Testcase: Blockedby: | Difficulty: Unknown Os: Unknown/Multiple | Blocking: Architecture: Unknown/Multiple | Failure: None/Unknown --+- Changes (by igloo): * type: proposal = task -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar |Owner: simonmar Type: proposal | Status: new Priority: normal |Milestone: Not GHC Component: libraries/process | Version: 6.8.2 Keywords: | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown --+- Comment(by simonmar): We might as well keep this open, rather than start a new ticket, I think. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar |Owner: simonmar Type: proposal | Status: new Priority: normal |Milestone: Not GHC Component: libraries/process | Version: 6.8.2 Keywords: | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown --+- Changes (by igloo): * owner: = simonmar * failure: = None/Unknown Comment: The original patch has been applied, and the second round of changes is 2 years old. Simon, can I suggest closing this ticket and, if appropriate, making a new proposal for the other changes? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar |Owner: Type: proposal | Status: new Priority: normal |Milestone: Not GHC Component: libraries/process | Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: Unknown/Multiple | --+- Comment (by sunrise): {{{ #!html This works ok for me.. but It probably needs feedback. a href=http://www.sneakerright.com;font color=#00haskell Air Jordan/font/a }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process ---+ Reporter: simonmar | Owner: Type: proposal | Status: new Priority: normal | Milestone: Not GHC Component: libraries/process |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown| ---+ Comment (by simonmar): Another round of changes has been posted for comment. Haddock docs in the same location: [http://darcs.haskell.org/~simonmar/process/System- Process.html], and the patch message is as follows: {{{ * More System.Process overhaul New functions: callProcess :: FilePath - [String] - IO () callCommand :: String - IO () spawnProcess :: FilePath - [String] - IO ProcessHandle spawnCommand :: String - IO ProcessHandle Changes: - system and rawSystem have been removed from System.Process again. (they were only there temporarily after the last round of changes, now callCommand and callProcess replace them respectively). On Unix systems we now use SIGCHLD to detect process completion instead of calling waitpid(). This has several advantages: - much cheaper: no extra OS threads to do the waiting - doesn't require -threaded to get non-blocking waitForProcess - waitForProcess can be interrupted - no zombie process left around (only relevant on Unix) However, it relies on the new signal API (see separate proposal). And these advantages aren't available on Windows (yet). }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process ---+ Reporter: simonmar | Owner: Type: proposal | Status: new Priority: normal | Milestone: Not GHC Component: libraries/process |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown| ---+ Changes (by Deewiant): * cc: Deewiant (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process ---+ Reporter: simonmar | Owner: Type: proposal | Status: new Priority: normal | Milestone: Not GHC Component: libraries/process |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown| ---+ Comment (by duncan): Further to the changes already made we discussed some ideas on #ghc today: Deprecate: * `runCommand` * `runProcess` * `runInteractiveCommand` * `runInteractiveCommand` The rationale is that these are all more limited than the new `createProcess` and yet none of them are really convenient. It's better to have fewer variations if they can all be expressed easily using `createProcess`. It makes the API much simpler. Also we'd not add `system` or `rawSystem` to `System.Process`. That would leave just: * `createProcess` * `readProcess` * `readProcessWithExitCode` Then add the following: * `callProcess :: FilePath - [String] - IO ()` * `callCommand :: String - IO ()` These would be synchronous like the current `system` and `rawSystem`. The difference is they would throw `IOError`s on failure rather than returning the `ExitCode` which is so easily ignored. These are of course only convenience functions. If someone wants the exit code it should be easy to do it via `createProcess` and `waitForProcess`. We need to make sure that is indeed the case. We'd also add async versions of the above: * `spawnProcess :: FilePath - [String] - IO ProcessHandle` * `spawnCommand :: String - IO ProcessHandle` that do not wait for the process to finish and return the ProcessHandle. Again these should be easy instances of `createProcess`. The docs should probably say as much so it's clear how to make minor variations. We also discussed how it should be safe to GC the `ProcessHandle` and not end up with zombie processes on unix systems. On Windows it's actually easy because you can close the process handle which means you don't get the exit status of the process. On unix we have to collect the exit status of every child process (actually you can ignore all of them, but you cannot ignore them selectively). The point is that with a convenient `spawnProcess` it's tempting to ignore the `ProcessHandle` result and never bother calling `waitForProcess` on it. We do want to support that. At the moment doing that would leave zombie processes. We discussed a mechanism to allow GC'ing `ProcessHandle`s that does not leave zombies. It'd probably involve keeping a `Map PID (MVar ExitCode)` and embedding a `MVar ExitCode` in the `ProcessHandle`. Then when we get notified that a child process terminated we would store the exit status in the `MVar`. Then `waitForProcess` would just wait on that `MVar ExitCode`. The one thing we have left that we cannot express with `createProcess` is the behavior with respect to `^C` handling. For some processes we want to delegate `^C` handling to that child process (eg imagine calling `ghci`). For others we want to handle `^C` 'normally'. For details see #2301. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #2233: Overhaul System.Process
#2233: Overhaul System.Process --+- Reporter: simonmar | Owner: Type: proposal | Status: new Priority: normal | Milestone: Not GHC Component: libraries/process | Version: 6.8.2 Severity: normal |Keywords: Difficulty: Unknown|Testcase: Architecture: Unknown| Os: Unknown --+- == Overhaul of System.Process == From the patch: {{{ Tue Apr 22 15:02:16 PDT 2008 Simon Marlow [EMAIL PROTECTED] * Overhall System.Process - fix #1780: pipes created by runInteractiveProcess are set close-on-exec by default - add a new, more general, form of process creation: createProcess Each of stdin, stdout and stderr may individually be taken from existing Handles or attached to new pipes. Also it has a nicer API. - add readProcess from Don Stewart's newpopen package. This function behaves like C's popen(). - Move System.Cmd.{system,rawSystem} into System.Process. Later we can depecate System.Cmd. - Don't use O_NONBLOCK for pipes, as it can confuse the process attached to the pipe (requires a fix to GHC.Handle in the base package). - move the tests from the GHC testsuite into the package itself, and add a couple more - bump the version to 2.0 }}} Haddock for the new API is here: [http://darcs.haskell.org/~simonmar/process/System-Process.html] Patch is attached. So far I've only modified the Unix parts of the code, the Windows parts still need to be updated. Discussion period: 4 weeks (20 May) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2233 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs