Enum watchexec::Shell[][src]

pub enum Shell {
    None,
    Unix(String),
    Powershell,
}
Expand description

Shell to use to run commands.

Cmd and Powershell are special-cased because they have different calling conventions. Also Cmd is only available in Windows, while Powershell is also available on unices (provided the end-user has it installed, of course).

See Config.cmd for the semantics of None vs the other options.

Variants

None

Use no shell, and execute the command directly.

Unix(String)

Use the given string as a unix shell invocation.

This means two things:

  • the program is invoked with -c followed by the command, and
  • the string will be split on space, and the resulting vec used as execvp(3) arguments: first is the shell program, rest are additional arguments (which come before the -c mentioned above). This is a very simplistic approach deliberately: it will not support quoted arguments, for example. Use Shell::None with a custom command vec if you want that.
Powershell

Use Powershell, on Windows or elsewhere.

This is invoked with -Command followed by the command.

This is preferred over Unix("pwsh"), though that will also work on unices due to Powershell supporting the -c short option.

Implementations

Obtain a Command given the cmd vec from Config.

Behaves as described in the enum documentation.

Panics

  • Panics if cmd is empty.
  • Panics if the string in the Unix variant is empty or only whitespace.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.