Skip to content

Commit

Permalink
Merge pull request #229 from Screenly/fix-windows-browser-open
Browse files Browse the repository at this point in the history
Fix windows browser open command
  • Loading branch information
sergey-borovkov authored Jan 8, 2025
2 parents 457b126 + d595f80 commit 00080ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/commands/edge_app/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ impl EdgeAppCommand {
}

fn open_browser(&self, address: &str) -> Result<(), CommandError> {
let command = match std::env::consts::OS {
"macos" => "open",
"windows" => "start",
"linux" => "xdg-open",
let (command, args) = match std::env::consts::OS {
"macos" => ("open", vec![address]),
"windows" => ("cmd", vec!["/C", "start", "", address]),
"linux" => ("xdg-open", vec![address]),
_ => {
return Err(CommandError::OpenBrowserError(
"Unsupported OS to open browser".to_string(),
Expand All @@ -270,14 +270,14 @@ impl EdgeAppCommand {
};

let output = std::process::Command::new(command)
.arg(address)
.args(&args)
.output()
.expect("Failed to open browser");

if !output.status.success() {
return Err(CommandError::OpenBrowserError(format!(
"Failed to open browser: {}",
str::from_utf8(&output.stderr).unwrap()
std::str::from_utf8(&output.stderr).unwrap()
)));
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/edge_app/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn is_included(entry: &DirEntry, ignore: &Ignorer) -> bool {
return false;
}

return !ignore.is_ignored(entry.path());
!ignore.is_ignored(entry.path())
}

pub fn transform_edge_app_path_to_manifest(path: &Option<String>) -> Result<PathBuf, CommandError> {
Expand Down

0 comments on commit 00080ba

Please sign in to comment.