mod.rs
This file
Path
src/exec/mod.rs
511 lines · 17.2 KiB · Rust
Last changed by
Group together output from multi exec commandsThayne McCombsbefore adoption9fb0c5d
History of this fileTake it
The walk stopped after 200 commits: lines older than 9412648 point at it.
Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 1–5why, one step back1mod command;2mod input;3mod job;4mod token;5use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
lines 6–8why, one step back6use std::borrow::Cow;7use std::ffi::{OsStr, OsString};8use std::path::{Component, Path, PathBuf, Prefix};Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 9–12why, one step back9use std::process::{Command, Stdio};10use std::sync::{Arc, Mutex};1112use anyhow::{anyhow, Result};Remove `lazy_static` from dependenciesShun Sakaibefore adoption0484486
line 13why, one step back13use once_cell::sync::Lazy;Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 14–17why, one step back14use regex::Regex;1516use crate::exit_codes::ExitCode;17Group together output from multi exec commandsThayne McCombsbefore adoption9fb0c5d
line 18why, one step back18use self::command::{execute_commands, handle_cmd_error};Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 19–32why, one step back19use self::input::{basename, dirname, remove_extension};20pub use self::job::{batch, job};21use self::token::Token;2223/// Execution mode of the command24#[derive(Debug, Clone, Copy, PartialEq)]25pub enum ExecutionMode {26 /// Command is executed for each search result27 OneByOne,28 /// Command is run for a batch of results at once29 Batch,30}3132#[derive(Debug, Clone, PartialEq)]Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 33why, one step back33pub struct CommandSet {Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 34why, one step back34 mode: ExecutionMode,use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 35why, one step back35 path_separator: Option<String>,Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 36why, one step back36 commands: Vec<CommandTemplate>,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 37–38why, one step back37}38Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 39–40why, one step back39impl CommandSet {40 pub fn new<I, S>(input: I, path_separator: Option<String>) -> CommandSetAdd link to troubleshooting sectionsharkdpbefore adoption9412648
line 41why, one step back41 whereSupport multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 42why, one step back42 I: IntoIterator<Item = Vec<S>>,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 43–44why, one step back43 S: AsRef<str>,44 {Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 45–49why, one step back45 CommandSet {46 mode: ExecutionMode::OneByOne,47 path_separator,48 commands: input.into_iter().map(CommandTemplate::new).collect(),49 }Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 50–51why, one step back50 }51Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 52why, one step back52 pub fn new_batch<I, S>(input: I, path_separator: Option<String>) -> Result<CommandSet>Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 53why, one step back53 whereSupport multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 54why, one step back54 I: IntoIterator<Item = Vec<S>>,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 55–56why, one step back55 S: AsRef<str>,56 {Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 57–88why, one step back57 Ok(CommandSet {58 mode: ExecutionMode::Batch,59 path_separator,60 commands: input61 .into_iter()62 .map(|args| {63 let cmd = CommandTemplate::new(args);64 if cmd.number_of_tokens() > 1 {65 return Err(anyhow!("Only one placeholder allowed for batch commands"));66 }67 if cmd.args[0].has_tokens() {68 return Err(anyhow!(69 "First argument of exec-batch is expected to be a fixed executable"70 ));71 }72 Ok(cmd)73 })74 .collect::<Result<Vec<_>>>()?,75 })76 }7778 pub fn in_batch_mode(&self) -> bool {79 self.mode == ExecutionMode::Batch80 }8182 pub fn execute(83 &self,84 input: &Path,85 mut out_perm: Arc<Mutex<()>>,86 buffer_output: bool,87 ) -> ExitCode {88 let path_separator = self.path_separator.as_deref();Group together output from multi exec commandsThayne McCombsbefore adoption9fb0c5d
lines 89–93why, one step back89 let commands = self90 .commands91 .iter()92 .map(|c| c.generate(input, path_separator));93 execute_commands(commands, &mut out_perm, buffer_output)Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 94–95why, one step back94 }95Group together output from multi exec commandsThayne McCombsbefore adoption9fb0c5d
line 96why, one step back96 pub fn execute_batch<I>(&self, paths: I) -> ExitCodeSupport multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 97–103why, one step back97 where98 I: Iterator<Item = PathBuf>,99 {100 let path_separator = self.path_separator.as_deref();101 let mut paths = paths.collect::<Vec<_>>();102 paths.sort();103 for cmd in &self.commands {Group together output from multi exec commandsThayne McCombsbefore adoption9fb0c5d
line 104why, one step back104 let exit = cmd.generate_and_execute_batch(&paths, path_separator);Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 105–107why, one step back105 if exit != ExitCode::Success {106 return exit;107 }Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 108why, one step back108 }Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 109why, one step back109 ExitCode::SuccessAdd link to troubleshooting sectionsharkdpbefore adoption9412648
line 110why, one step back110 }Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 111why, one step back111}Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 112why, one step back112Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 113–123why, one step back113/// Represents a template that is utilized to generate command strings.114///115/// The template is meant to be coupled with an input in order to generate a command. The116/// `generate_and_execute()` method will be used to generate a command and execute it.117#[derive(Debug, Clone, PartialEq)]118struct CommandTemplate {119 args: Vec<ArgumentTemplate>,120}121122impl CommandTemplate {123 fn new<I, S>(input: I) -> CommandTemplateAdd link to troubleshooting sectionsharkdpbefore adoption9412648
lines 124–127why, one step back124 where125 I: IntoIterator<Item = S>,126 S: AsRef<str>,127 {Remove `lazy_static` from dependenciesShun Sakaibefore adoption0484486
lines 128–129why, one step back128 static PLACEHOLDER_PATTERN: Lazy<Regex> =129 Lazy::new(|| Regex::new(r"\{(/?\.?|//)\}").unwrap());Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 130–178why, one step back130131 let mut args = Vec::new();132 let mut has_placeholder = false;133134 for arg in input {135 let arg = arg.as_ref();136137 let mut tokens = Vec::new();138 let mut start = 0;139140 for placeholder in PLACEHOLDER_PATTERN.find_iter(arg) {141 // Leading text before the placeholder.142 if placeholder.start() > start {143 tokens.push(Token::Text(arg[start..placeholder.start()].to_owned()));144 }145146 start = placeholder.end();147148 match placeholder.as_str() {149 "{}" => tokens.push(Token::Placeholder),150 "{.}" => tokens.push(Token::NoExt),151 "{/}" => tokens.push(Token::Basename),152 "{//}" => tokens.push(Token::Parent),153 "{/.}" => tokens.push(Token::BasenameNoExt),154 _ => unreachable!("Unhandled placeholder"),155 }156157 has_placeholder = true;158 }159160 // Without a placeholder, the argument is just fixed text.161 if tokens.is_empty() {162 args.push(ArgumentTemplate::Text(arg.to_owned()));163 continue;164 }165166 if start < arg.len() {167 // Trailing text after last placeholder.168 tokens.push(Token::Text(arg[start..].to_owned()));169 }170171 args.push(ArgumentTemplate::Tokens(tokens));172 }173174 // If a placeholder token was not supplied, append one at the end of the command.175 if !has_placeholder {176 args.push(ArgumentTemplate::Tokens(vec![Token::Placeholder]));177 }178Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 179why, one step back179 CommandTemplate { args }Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 180–188why, one step back180 }181182 fn number_of_tokens(&self) -> usize {183 self.args.iter().filter(|arg| arg.has_tokens()).count()184 }185186 /// Generates and executes a command.187 ///188 /// Using the internal `args` field, and a supplied `input` variable, a `Command` will beGroup together output from multi exec commandsThayne McCombsbefore adoption9fb0c5d
lines 189–190why, one step back189 /// build.190 fn generate(&self, input: &Path, path_separator: Option<&str>) -> Command {Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 191why, one step back191 let mut cmd = Command::new(self.args[0].generate(&input, path_separator));Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 192why, one step back192 for arg in &self.args[1..] {Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 193why, one step back193 cmd.arg(arg.generate(&input, path_separator));Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 194why, one step back194 }Group together output from multi exec commandsThayne McCombsbefore adoption9fb0c5d
line 195why, one step back195 cmdAdd link to troubleshooting sectionsharkdpbefore adoption9412648
lines 196–197why, one step back196 }197Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 198–199why, one step back198 fn generate_and_execute_batch(199 &self,Fix clippy lintsThayne McCombsbefore adoptionf27332e
line 200why, one step back200 paths: &[PathBuf],Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 201–202why, one step back201 path_separator: Option<&str>,202 ) -> ExitCode {use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 203why, one step back203 let mut cmd = Command::new(self.args[0].generate("", None));Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 204–211why, one step back204 cmd.stdin(Stdio::inherit());205 cmd.stdout(Stdio::inherit());206 cmd.stderr(Stdio::inherit());207208 let mut has_path = false;209210 for arg in &self.args[1..] {211 if arg.has_tokens() {Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 212–213why, one step back212 for path in paths {213 cmd.arg(arg.generate(path, path_separator));Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 214–216why, one step back214 has_path = true;215 }216 } else {use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 217why, one step back217 cmd.arg(arg.generate("", None));Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 218–221why, one step back218 }219 }220221 if has_path {Group together output from multi exec commandsThayne McCombsbefore adoption9fb0c5d
lines 222–225why, one step back222 match cmd.spawn().and_then(|mut c| c.wait()) {223 Ok(_) => ExitCode::Success,224 Err(e) => handle_cmd_error(&cmd, e),225 }Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 226–243why, one step back226 } else {227 ExitCode::Success228 }229 }230}231232/// Represents a template for a single command argument.233///234/// The argument is either a collection of `Token`s including at least one placeholder variant, or235/// a fixed text.236#[derive(Clone, Debug, PartialEq)]237enum ArgumentTemplate {238 Tokens(Vec<Token>),239 Text(String),240}241242impl ArgumentTemplate {243 pub fn has_tokens(&self) -> bool {Fix clippy warningsDavid Peterbefore adoption2a2126c
line 244why, one step back244 matches!(self, ArgumentTemplate::Tokens(_))Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 245–246why, one step back245 }246use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
lines 247–250why, one step back247 /// Generate an argument from this template. If path_separator is Some, then it will replace248 /// the path separator in all placeholder tokens. Text arguments and tokens are not affected by249 /// path separator substitution.250 pub fn generate(&self, path: impl AsRef<Path>, path_separator: Option<&str>) -> OsString {Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 251why, one step back251 use self::Token::*;use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 252why, one step back252 let path = path.as_ref();Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 253–258why, one step back253254 match *self {255 ArgumentTemplate::Tokens(ref tokens) => {256 let mut s = OsString::new();257 for token in tokens {258 match *token {use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
lines 259–270why, one step back259 Basename => s.push(Self::replace_separator(basename(path), path_separator)),260 BasenameNoExt => s.push(Self::replace_separator(261 &remove_extension(basename(path).as_ref()),262 path_separator,263 )),264 NoExt => s.push(Self::replace_separator(265 &remove_extension(path),266 path_separator,267 )),268 Parent => s.push(Self::replace_separator(&dirname(path), path_separator)),269 Placeholder => {270 s.push(Self::replace_separator(path.as_ref(), path_separator))Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 271–279why, one step back271 }272 Text(ref string) => s.push(string),273 }274 }275 s276 }277 ArgumentTemplate::Text(ref text) => OsString::from(text),278 }279 }use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
lines 280–334why, one step back280281 /// Replace the path separator in the input with the custom separator string. If path_separator282 /// is None, simply return a borrowed Cow<OsStr> of the input. Otherwise, the input is283 /// interpreted as a Path and its components are iterated through and re-joined into a new284 /// OsString.285 fn replace_separator<'a>(path: &'a OsStr, path_separator: Option<&str>) -> Cow<'a, OsStr> {286 // fast-path - no replacement necessary287 if path_separator.is_none() {288 return Cow::Borrowed(path);289 }290291 let path_separator = path_separator.unwrap();292 let mut out = OsString::with_capacity(path.len());293 let mut components = Path::new(path).components().peekable();294295 while let Some(comp) = components.next() {296 match comp {297 // Absolute paths on Windows are tricky. A Prefix component is usually a drive298 // letter or UNC path, and is usually followed by RootDir. There are also299 // "verbatim" prefixes beginning with "\\?\" that skip normalization. We choose to300 // ignore verbatim path prefixes here because they're very rare, might be301 // impossible to reach here, and there's no good way to deal with them. If users302 // are doing something advanced involving verbatim windows paths, they can do their303 // own output filtering with a tool like sed.304 Component::Prefix(prefix) => {305 if let Prefix::UNC(server, share) = prefix.kind() {306 // Prefix::UNC is a parsed version of '\\server\share'307 out.push(path_separator);308 out.push(path_separator);309 out.push(server);310 out.push(path_separator);311 out.push(share);312 } else {313 // All other Windows prefix types are rendered as-is. This results in e.g. "C:" for314 // drive letters. DeviceNS and Verbatim* prefixes won't have backslashes converted,315 // but they're not returned by directories fd can search anyway so we don't worry316 // about them.317 out.push(comp.as_os_str());318 }319 }320321 // Root directory is always replaced with the custom separator.322 Component::RootDir => out.push(path_separator),323324 // Everything else is joined normally, with a trailing separator if we're not last325 _ => {326 out.push(comp.as_os_str());327 if components.peek().is_some() {328 out.push(path_separator);329 }330 }331 }332 }333 Cow::Owned(out)334 }Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 335–343why, one step back335}336337#[cfg(test)]338mod tests {339 use super::*;340341 #[test]342 fn tokens_with_placeholder() {343 assert_eq!(Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 344–352why, one step back344 CommandSet::new(vec![vec![&"echo", &"${SHELL}:"]], None),345 CommandSet {346 commands: vec![CommandTemplate {347 args: vec![348 ArgumentTemplate::Text("echo".into()),349 ArgumentTemplate::Text("${SHELL}:".into()),350 ArgumentTemplate::Tokens(vec![Token::Placeholder]),351 ]352 }],Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 353why, one step back353 mode: ExecutionMode::OneByOne,use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 354why, one step back354 path_separator: None,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 355–361why, one step back355 }356 );357 }358359 #[test]360 fn tokens_with_no_extension() {361 assert_eq!(Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 362–369why, one step back362 CommandSet::new(vec![vec!["echo", "{.}"]], None),363 CommandSet {364 commands: vec![CommandTemplate {365 args: vec![366 ArgumentTemplate::Text("echo".into()),367 ArgumentTemplate::Tokens(vec![Token::NoExt]),368 ],369 }],Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 370why, one step back370 mode: ExecutionMode::OneByOne,use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 371why, one step back371 path_separator: None,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 372–378why, one step back372 }373 );374 }375376 #[test]377 fn tokens_with_basename() {378 assert_eq!(Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 379–386why, one step back379 CommandSet::new(vec![vec!["echo", "{/}"]], None),380 CommandSet {381 commands: vec![CommandTemplate {382 args: vec![383 ArgumentTemplate::Text("echo".into()),384 ArgumentTemplate::Tokens(vec![Token::Basename]),385 ],386 }],Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 387why, one step back387 mode: ExecutionMode::OneByOne,use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 388why, one step back388 path_separator: None,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 389–395why, one step back389 }390 );391 }392393 #[test]394 fn tokens_with_parent() {395 assert_eq!(Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 396–403why, one step back396 CommandSet::new(vec![vec!["echo", "{//}"]], None),397 CommandSet {398 commands: vec![CommandTemplate {399 args: vec![400 ArgumentTemplate::Text("echo".into()),401 ArgumentTemplate::Tokens(vec![Token::Parent]),402 ],403 }],Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 404why, one step back404 mode: ExecutionMode::OneByOne,use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 405why, one step back405 path_separator: None,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 406–412why, one step back406 }407 );408 }409410 #[test]411 fn tokens_with_basename_no_extension() {412 assert_eq!(Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 413–420why, one step back413 CommandSet::new(vec![vec!["echo", "{/.}"]], None),414 CommandSet {415 commands: vec![CommandTemplate {416 args: vec![417 ArgumentTemplate::Text("echo".into()),418 ArgumentTemplate::Tokens(vec![Token::BasenameNoExt]),419 ],420 }],Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 421why, one step back421 mode: ExecutionMode::OneByOne,use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 422why, one step back422 path_separator: None,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 423–429why, one step back423 }424 );425 }426427 #[test]428 fn tokens_multiple() {429 assert_eq!(Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 430–441why, one step back430 CommandSet::new(vec![vec!["cp", "{}", "{/.}.ext"]], None),431 CommandSet {432 commands: vec![CommandTemplate {433 args: vec![434 ArgumentTemplate::Text("cp".into()),435 ArgumentTemplate::Tokens(vec![Token::Placeholder]),436 ArgumentTemplate::Tokens(vec![437 Token::BasenameNoExt,438 Token::Text(".ext".into())439 ]),440 ],441 }],Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 442why, one step back442 mode: ExecutionMode::OneByOne,use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 443why, one step back443 path_separator: None,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 444–450why, one step back444 }445 );446 }447448 #[test]449 fn tokens_single_batch() {450 assert_eq!(Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
lines 451–453why, one step back451 CommandSet::new_batch(vec![vec!["echo", "{.}"]], None).unwrap(),452 CommandSet {453 commands: vec![CommandTemplate {Fix clippy lintsThayne McCombsbefore adoptionf27332e
lines 454–457why, one step back454 args: vec![455 ArgumentTemplate::Text("echo".into()),456 ArgumentTemplate::Tokens(vec![Token::NoExt]),457 ],Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 458why, one step back458 }],Add link to troubleshooting sectionsharkdpbefore adoption9412648
line 459why, one step back459 mode: ExecutionMode::Batch,use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
line 460why, one step back460 path_separator: None,Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 461–466why, one step back461 }462 );463 }464465 #[test]466 fn tokens_multiple_batch() {Support multiple `--exec` instancesThayne McCombsbefore adoption0aee9b0
line 467why, one step back467 assert!(CommandSet::new_batch(vec![vec!["echo", "{.}", "{}"]], None).is_err());use custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
lines 468–501why, one step back468 }469470 #[test]471 fn generate_custom_path_separator() {472 let arg = ArgumentTemplate::Tokens(vec![Token::Placeholder]);473 macro_rules! check {474 ($input:expr, $expected:expr) => {475 assert_eq!(arg.generate($input, Some("#")), OsString::from($expected));476 };477 }478479 check!("foo", "foo");480 check!("foo/bar", "foo#bar");481 check!("/foo/bar/baz", "#foo#bar#baz");482 }483484 #[cfg(windows)]485 #[test]486 fn generate_custom_path_separator_windows() {487 let arg = ArgumentTemplate::Tokens(vec![Token::Placeholder]);488 macro_rules! check {489 ($input:expr, $expected:expr) => {490 assert_eq!(arg.generate($input, Some("#")), OsString::from($expected));491 };492 }493494 // path starting with a drive letter495 check!(r"C:\foo\bar", "C:#foo#bar");496 // UNC path497 check!(r"\\server\share\path", "##server#share#path");498 // Drive Relative path - no separator after the colon omits the RootDir path component.499 // This is uncommon, but valid500 check!(r"C:foo\bar", "C:foo#bar");501fix spellinga1346054before adoption5b4869a
line 502why, one step back502 // forward slashes should get normalized and interpreted as separatorsuse custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
lines 503–505why, one step back503 check!("C:/foo/bar", "C:#foo#bar");504 check!("C:foo/bar", "C:foo#bar");505fix spellinga1346054before adoption5b4869a
line 506why, one step back506 // Rust does not interpret "//server/share" as a UNC path, but rather as a normaluse custom --path-separator in arguments to --execAllen Wildbefore adoption8a532e5
lines 507–509why, one step back507 // absolute path that begins with RootDir, and the two slashes get combined together as508 // a single path separator during normalization.509 //check!("//server/share/path", "##server#share#path");Add link to troubleshooting sectionsharkdpbefore adoption9412648
lines 510–511why, one step back510 }511}