tailhook / unshare

The low-level linux containers creation library for rust
Apache License 2.0
124 stars 27 forks source link

Call setpgid flag #3

Closed anti-social closed 8 years ago

tailhook commented 8 years ago

Apart from coments in code, I think that group leadership should be contributed here. But the terminal control should be implemented in the vagga itself.

anti-social commented 8 years ago

Implemented terminal control in the vagga, all tests passed.

anti-social commented 8 years ago

Dont understand how I could rid of ErrorCode for setpgid. Why we need ErrorCode enum at all? I think there should be only Error enum with different From implementations.

tailhook commented 8 years ago

Why we need ErrorCode enum at all?

Error code is sent from child process to parent when eror happens in child. So it is required only for errors that happen in child.

Othewise looks fine. You may squash the commits.

anti-social commented 8 years ago

To rid of ErrorCode::SetPGid I should write something like:

match setpgid(pid, pid) {
    Ok(_) => {},
    Result::Err(nix::Error::Sys(x)) => return Result::Err(Error::SetPGid(x as i32)),
    Result::Err(nix::Error::InvalidPath) => return Result::Err(Error::InvalidPath),
}

Also there are another errors with codes that happen only in parent process.

tailhook commented 8 years ago

Ah, sorry. I probably misremember something :)