Skip to content

Commit

Permalink
Remove setssid option
Browse files Browse the repository at this point in the history
  • Loading branch information
gjhenrique committed Dec 13, 2022
1 parent 8db99e8 commit f68b937
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions sh/sh.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ func SpawnAsyncProcess(command []string, args string) error {
args2 := append(command[1:], args)

cmd := exec.Command(command[0], args2...)
cmd.SysProcAttr = &syscall.SysProcAttr{
Setsid: true,
}

err := cmd.Start()

Expand Down Expand Up @@ -69,6 +66,7 @@ func Fzf(entries []Entry) (*Entry, error) {
bind := fmt.Sprintf("change:reload:%s search {q} || true", ownExe)
command := []string{
"fzf",
"--exact",
"--no-info",
"--nth=..3",
"--with-nth=3",
Expand All @@ -88,12 +86,26 @@ func Fzf(entries []Entry) (*Entry, error) {
}

result, err := SpawnSyncProcess(command, []byte(FormatEntries(entries)))

// https://www.mankier.com/1/fzf#Exit_Status
if exitError, ok := err.(*exec.ExitError); ok {
// No
if exitError.ExitCode() == 1 {
return nil, nil
}
} else {
return nil, err
}

if err != nil {
return nil, err
}

splittedResult := strings.Split(result, "\n")
// query := splittedResult[0]
fmt.Println(splittedResult[0])
fmt.Println(splittedResult[1])
fmt.Println("vsf")

// TODO: Make \034 a variable
separatedEntry := strings.Split(splittedResult[1], "\034")
Expand Down

0 comments on commit f68b937

Please sign in to comment.