digitalmars.D.learn - potential deadlock spawning process
- Daniel Davidson (8/8) Oct 08 2013 This simple script calls out to find (on a Mac). For me this
- Daniel Davidson (16/24) Oct 08 2013 I found a workaround with pipeProcess.
This simple script calls out to find (on a Mac). For me this works. If I increase the output by changing maxdepth to 3 it hangs forever. When I run the same find from the shell it is fine. What could cause a deadlock in this and what is a workaround? http://pastebin.com/ji8dZwAY Thanks Dan
Oct 08 2013
On Tuesday, 8 October 2013 at 16:24:50 UTC, Daniel Davidson wrote:This simple script calls out to find (on a Mac). For me this works. If I increase the output by changing maxdepth to 3 it hangs forever. When I run the same find from the shell it is fine. What could cause a deadlock in this and what is a workaround? http://pastebin.com/ji8dZwAY Thanks DanI found a workaround with pipeProcess. auto pipes = pipeProcess(spec, Redirect.stdout | Redirect.stderr); scope(exit) { auto exitCode = wait(pipes.pid); if(exitCode) { writeln("*** Exited rc(", exitCode, ")"); } } foreach (line; pipes.stdout.byLine) writeln(line); foreach (line; pipes.stderr.byLine) writeln(text("STDERR| ", line.idup)); } Thanks, Dan
Oct 08 2013