forked from mutagen-io/mutagen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssh_posix.go
34 lines (28 loc) · 1022 Bytes
/
ssh_posix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// +build !windows,!plan9
// TODO: Figure out what to do for Plan 9. It doesn't support Setsid.
package ssh
import (
"syscall"
)
// scpCommand returns the name of or path to the scp command.
func scpCommand() (string, error) {
return "scp", nil
}
// sshCommand returns the name of or path to the ssh command.
func sshCommand() (string, error) {
return "ssh", nil
}
// processAttributes returns the process attributes to use for starting ssh or
// scp.
func processAttributes() *syscall.SysProcAttr {
return &syscall.SysProcAttr{
// There's also a Noctty field, but it only detaches standard input from
// the controlling terminal (not standard output or error), and if
// standard input isn't a terminal, it will fail to launch the process.
// Setsid might be a little heavy handed since it creates a new process
// group, but it also properly detaches the process from any controlling
// terminal, and it's a standard system call, so it seems to be the most
// robust option.
Setsid: true,
}
}