mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-15 14:53:47 -05:00
Code cleanup: Remove unused argument
This commit is contained in:
@@ -88,7 +88,7 @@ func (r *Reader) terminate() {
|
|||||||
func (r *Reader) restart(command string) {
|
func (r *Reader) restart(command string) {
|
||||||
r.event = int32(EvtReady)
|
r.event = int32(EvtReady)
|
||||||
r.startEventPoller()
|
r.startEventPoller()
|
||||||
success := r.readFromCommand(nil, command)
|
success := r.readFromCommand(command)
|
||||||
r.fin(success)
|
r.fin(success)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ func (r *Reader) ReadSource() {
|
|||||||
if len(cmd) == 0 {
|
if len(cmd) == 0 {
|
||||||
success = r.readFiles()
|
success = r.readFiles()
|
||||||
} else {
|
} else {
|
||||||
success = r.readFromCommand(nil, cmd)
|
success = r.readFromCommand(cmd)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
success = r.readFromStdin()
|
success = r.readFromStdin()
|
||||||
@@ -171,15 +171,11 @@ func (r *Reader) readFiles() bool {
|
|||||||
return fastwalk.Walk(&conf, ".", fn) == nil
|
return fastwalk.Walk(&conf, ".", fn) == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Reader) readFromCommand(shell *string, command string) bool {
|
func (r *Reader) readFromCommand(command string) bool {
|
||||||
r.mutex.Lock()
|
r.mutex.Lock()
|
||||||
r.killed = false
|
r.killed = false
|
||||||
r.command = &command
|
r.command = &command
|
||||||
if shell != nil {
|
r.exec = util.ExecCommand(command, true)
|
||||||
r.exec = util.ExecCommandWith(*shell, command, true)
|
|
||||||
} else {
|
|
||||||
r.exec = util.ExecCommand(command, true)
|
|
||||||
}
|
|
||||||
out, err := r.exec.StdoutPipe()
|
out, err := r.exec.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.mutex.Unlock()
|
r.mutex.Unlock()
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func TestReadFromCommand(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Normal command
|
// Normal command
|
||||||
reader.fin(reader.readFromCommand(nil, `echo abc&&echo def`))
|
reader.fin(reader.readFromCommand(`echo abc&&echo def`))
|
||||||
if len(strs) != 2 || strs[0] != "abc" || strs[1] != "def" {
|
if len(strs) != 2 || strs[0] != "abc" || strs[1] != "def" {
|
||||||
t.Errorf("%s", strs)
|
t.Errorf("%s", strs)
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ func TestReadFromCommand(t *testing.T) {
|
|||||||
reader.startEventPoller()
|
reader.startEventPoller()
|
||||||
|
|
||||||
// Failing command
|
// Failing command
|
||||||
reader.fin(reader.readFromCommand(nil, `no-such-command`))
|
reader.fin(reader.readFromCommand(`no-such-command`))
|
||||||
strs = []string{}
|
strs = []string{}
|
||||||
if len(strs) > 0 {
|
if len(strs) > 0 {
|
||||||
t.Errorf("%s", strs)
|
t.Errorf("%s", strs)
|
||||||
|
|||||||
Reference in New Issue
Block a user