Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. module U = UnixLabels
  2.  
  3. let f () =
  4. let (_, pipe_w_1) = U.pipe () in
  5. let (pipe_r_2, _) = U.pipe () in
  6. let (pipe_r_3, _) = U.pipe () in
  7. let _ = U.create_process
  8. ~prog:"r2"
  9. ~args:[|"r2"; "-q0"; "/bin/ls"|]
  10. ~stdin:pipe_w_1
  11. ~stdout:pipe_r_2
  12. ~stderr:pipe_r_3
  13. in
  14. let cmd = "/j chown" in
  15. U.write pipe_w_1 ~buf:cmd ~pos:0 ~len:(String.length cmd) |> ignore;
  16. let buf = Bytes.create 10 in
  17. (try
  18. U.read pipe_r_2 ~buf ~pos:0 ~len:10 |> ignore;
  19. with _ ->
  20. ());
  21. print_endline buf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement