# Trait std::os::unix::process::CommandExt [−] [src]

    pub trait CommandExt {
        fn uid(&mut self, id: uid_t) -> &mut Command;
        fn gid(&mut self, id: gid_t) -> &mut Command;
        fn session_leader(&mut self, on: bool) -> &mut Command;
    }

Unix-specific extensions to the `std::process::Command` builder

## Required Methods

### `fn uid(&mut self, id: uid_t) -> &mut Command`

Sets the child process's user id. This translates to a `setuid` call in the child process. Failure in the `setuid` call will cause the spawn to fail.

### `fn gid(&mut self, id: gid_t) -> &mut Command`

Similar to `uid`, but sets the group id of the child process. This has the same semantics as the `uid` field.

### `fn session_leader(&mut self, on: bool) -> &mut Command`

Unstable (`process_session_leader` #27811)

: recently added

Create a new session (cf. `setsid(2)`) for the child process. This means that the child is the leader of a new process group. The parent process remains the child reaper of the new process.

This is not enough to create a daemon process. The init process should be the child reaper of a daemon. This can be achieved if the parent process exit. Moreover, a daemon should not have a controlling terminal. To achieve this, a session leader (the child) must spawn another process (the daemon) in the same session.

## Implementors

- `impl CommandExt for Command`
- `impl CommandExt for Command`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize`)