Skip to content

Commit

Permalink
fix: open when app != "" (#203)
Browse files Browse the repository at this point in the history
The important part is the change of `==` to `!=`. I also moved the if block to a more sensible place.

I have not tested this.

Fixes #202
  • Loading branch information
ilyagr authored Oct 4, 2024
1 parent a4978c8 commit 1412391
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions exp/open/open_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ func buildCmd(ctx context.Context, app, path string) *exec.Cmd {
arg = append(arg, path)
return exec.CommandContext(ctx, "open", arg...)
}

if app != "" {
return exec.CommandContext(ctx, app, path)
}
if _, err := exec.LookPath("xdg-open"); err == nil {
if app == "" {
return exec.CommandContext(ctx, app, path)
}
return exec.CommandContext(ctx, "xdg-open", path)
}
return nil
Expand Down

0 comments on commit 1412391

Please sign in to comment.