Skip to content
Myr

Forbid --output=file without a path separator

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tavian Barnes · committed by David Peter · parent ecee9df · Browse files · 2 files+9 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−1 removed

  • other:+9 added−1 removed

2 files+9 added−1 removed

modified:src/error.rs+2 added
47 unmodified lines
48 #[error("An empty command has been specified for the '--shell <command>' option")]49 EmptyShell,50 #[error("Failed to parse '--shell <command>' expression as command line: {0}")]51 ShellParseError(shell_words::ParseError),52 #[error("Unknown output policy '{0}'. Use ./{0} to output to a file named {0}.")]53 UnknownOutputPolicy(String),54}
modified:src/options.rs+7 added-1 removed
273 unmodified lines
274 match output {275 "null" => CommandOutputPolicy::Discard,276 "pipe" => CommandOutputPolicy::Pipe,277 "inherit" => CommandOutputPolicy::Forward,278 path => CommandOutputPolicy::File(path.into()),278 arg => {279 let path = PathBuf::from(arg);280 if path.components().count() <= 1 {281 return Err(OptionsError::UnknownOutputPolicy(arg.to_string()));282 }283 CommandOutputPolicy::File(path)284 }285 }286 } else {287 CommandOutputPolicy::Discard288 };
111 unmodified lines