Shahid4

Untitled

Jun 27th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.46 KB | None | 0 0
  1.     // Start IPC here
  2.     auto set1 = FileDescriptor.pipe2();
  3.     auto set2 = FileDescriptor.pipe2();
  4.  
  5.     auto pid = Process.fork();
  6.  
  7.     if( pid == 0 )
  8.     {
  9.         Shdout.formatln("I am the child!");
  10.  
  11.         // Close stdin/stdout
  12.         fds[0].close();
  13.         fds[1].close();
  14.  
  15.         // Replace with pipe(r/w)
  16.         set1[0].dup2( 0 );
  17.         set2[1].dup2( 1 );
  18.  
  19.         set1[0].close();  set1[1].close();
  20.         set2[0].close();  set2[1].close();
  21.  
  22.         Process.execve( "/usr/bin/md5sum", ["md5sum"], null );
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment