Skip to content

Commit

Permalink
fix edge case where PAGER env var includes arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
sweetbbak authored and diamondburned committed Jul 7, 2024
1 parent 050d4a1 commit 2ec97c0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/nix-search/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,15 @@ func mainAction(c *cli.Context) error {
pager = "less"
}

pagerCmd := exec.CommandContext(ctx, pager)
var pagerCmd *exec.Cmd

psplit := strings.Split(pager, " ")
if len(psplit) > 1 {
pagerCmd = exec.CommandContext(ctx, psplit[0], psplit[1:]...)
} else {
pagerCmd = exec.CommandContext(ctx, pager)
}

pagerCmd.Stdout = os.Stdout
pagerCmd.Stderr = os.Stderr

Expand Down

0 comments on commit 2ec97c0

Please sign in to comment.