Advertisement
Guest User

deadlock process

a guest
Oct 8th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.57 KB | None | 0 0
  1. #!/usr/bin/rdmd
  2.  
  3. import std.stdio;
  4. import std.process;
  5.  
  6. void main(string[] argv) {
  7.   auto pout = pipe();
  8.   auto perr = pipe();
  9.   auto spec = [ "find", "/", "-maxdepth", "2" ];
  10.   writeln("Running ", spec);
  11.   auto dartPid = spawnProcess(spec, std.stdio.stdin,
  12.                               pout.writeEnd, perr.writeEnd);
  13.   auto rc = wait(dartPid);
  14.   if (rc != 0) {
  15.     writeln("**** Compilation failed(", rc,") ****");
  16.   }
  17.   foreach( line; pout.readEnd.byLine) {
  18.     writeln(line);
  19.   }
  20.   foreach( line; perr.readEnd.byLine) {
  21.     writeln("STDERR| ", line);
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement