in internal/remote/remote.go [196:219]
func RunCommandWithPipes(cmd string, e Executor) (string, error) {
commands := strings.Split(cmd, "|")
input := ""
for _, command := range commands {
f := func() error {
s, err := e.CreateSession(input)
if err != nil {
return fmt.Errorf("Failed to create a session. %v", err)
}
defer s.Close()
if input, err = e.Run(command, s); err != nil {
return err
}
return nil
}
if err := f(); err != nil {
return "", err
}
}
// the last "input" from Run is the final return value
return input, nil
}