Add std{in,out} for communication with child process#31
Conversation
| assert_eq!(libc::close(io1_fds[0]), 0); | ||
|
|
||
| assert_eq!(dup2(io2_fds[1], STDOUT_FILENO), STDOUT_FILENO); | ||
| assert_eq!(libc::close(io2_fds[1]), 0); |
There was a problem hiding this comment.
nit: indent these to match the other statements in this block.
pcwalton
left a comment
There was a problem hiding this comment.
I think I would prefer having stdin/stdout access be something you have to explicitly request via a sandbox profile. Servo doesn't need this and I don't want more HANDLEs available in the child process than absolutely necessary.
| cmd.stdout.read_exact(&mut buf[..]).unwrap(); | ||
| assert_eq!(buf, b"B"); | ||
|
|
||
| cmd.wait().unwrap(); |
There was a problem hiding this comment.
nit: fix indentation here too.
| assert_eq!(buf, b"A"); | ||
|
|
||
| io::stdout().write_all(b"B").unwrap(); | ||
| io::stdout().flush().unwrap(); |
There was a problem hiding this comment.
nit: fix indentation here.
| // Set this `prctl` flag so that we can wait on our grandchild. (Otherwise it'll be | ||
| // reparented to init.) | ||
| assert!(seccomp::prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) == 0); | ||
| assert_eq!(seccomp::prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0), 0); |
There was a problem hiding this comment.
Can you move this cleanup to a separate commit?
|
@pcwalton, sure, I should I put this stuff into a new Operation? |
|
☔ The latest upstream changes (presumably #51) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Sorry for asking a question here.
Nevermind. I somehow did it. |
No description provided.