Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module U = UnixLabels
- let f () =
- let (_, pipe_w_1) = U.pipe () in
- let (pipe_r_2, _) = U.pipe () in
- let (pipe_r_3, _) = U.pipe () in
- let _ = U.create_process
- ~prog:"r2"
- ~args:[|"r2"; "-q0"; "/bin/ls"|]
- ~stdin:pipe_w_1
- ~stdout:pipe_r_2
- ~stderr:pipe_r_3
- in
- let cmd = "/j chown" in
- U.write pipe_w_1 ~buf:cmd ~pos:0 ~len:(String.length cmd) |> ignore;
- let buf = Bytes.create 10 in
- (try
- U.read pipe_r_2 ~buf ~pos:0 ~len:10 |> ignore;
- with _ ->
- ());
- print_endline buf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement