www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - potential deadlock spawning process

reply "Daniel Davidson" <nospam spam.com> writes:
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
parent "Daniel Davidson" <nospam spam.com> writes:
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
 Dan
I 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