Skip to content

Commit

Permalink
control master logging
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Feb 7, 2024
1 parent 08efbdc commit 6b67483
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions openssh.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package rig

import (
"bytes"
"context"
"errors"
"fmt"
Expand Down Expand Up @@ -208,15 +209,16 @@ func (c *OpenSSH) Connect() error {
args = append(args, c.args()...)

cmd := goexec.Command("ssh", args...)
errBuf := bytes.NewBuffer(nil)
cmd.Stdout = nil
cmd.Stderr = nil
cmd.Stderr = errBuf
cmd.Stdin = nil

log.Debugf("%s: starting ssh control master", c)
err := cmd.Run()
if err != nil {
c.isConnected = false
return fmt.Errorf("failed to start ssh multiplexing control master: %w", err)
return fmt.Errorf("failed to start ssh multiplexing control master: %w (%s)", err, errBuf.String())
}

c.isConnected = true
Expand Down

0 comments on commit 6b67483

Please sign in to comment.