diff --git a/src/browser/process.rs b/src/browser/process.rs index db1a9f7c..5b091c48 100644 --- a/src/browser/process.rs +++ b/src/browser/process.rs @@ -50,6 +50,8 @@ enum ChromeLaunchError { NoAvailablePorts, #[error("The chosen debugging port is already in use")] DebugPortInUse, + #[error("You need to set the sandbox(false) option when running as root")] + RunningAsRootWithoutNoSandbox, } #[cfg(windows)] @@ -417,6 +419,7 @@ impl Process { R: Read, { let port_taken_re = Regex::new(r"ERROR.*bind\(\)")?; + let root_sandbox = "Running as root without --no-sandbox is not supported"; let re = Regex::new(r"listening on (.*/devtools/browser/.*)$")?; @@ -430,6 +433,10 @@ impl Process { let chrome_output = line?; trace!("Chrome output: {}", chrome_output); + if chrome_output.contains(root_sandbox) { + return Err(ChromeLaunchError::RunningAsRootWithoutNoSandbox {}.into()); + } + if port_taken_re.is_match(&chrome_output) { return Err(ChromeLaunchError::DebugPortInUse {}.into()); }