mirror of
https://github.com/octoleo/restic.git
synced 2024-12-02 09:58:25 +00:00
Only use Setsid on Unix.
Setsid is not a part of syscall.SysProcAttr on Windows, so we only set that on systems that have it.
This commit is contained in:
parent
7c84d810d3
commit
2dcb527828
@ -28,6 +28,8 @@ type SFTP struct {
|
|||||||
cmd *exec.Cmd
|
cmd *exec.Cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sysProcAttr syscall.SysProcAttr
|
||||||
|
|
||||||
func startClient(program string, args ...string) (*SFTP, error) {
|
func startClient(program string, args ...string) (*SFTP, error) {
|
||||||
// Connect to a remote host and request the sftp subsystem via the 'ssh'
|
// Connect to a remote host and request the sftp subsystem via the 'ssh'
|
||||||
// command. This assumes that passwordless login is correctly configured.
|
// command. This assumes that passwordless login is correctly configured.
|
||||||
@ -37,7 +39,7 @@ func startClient(program string, args ...string) (*SFTP, error) {
|
|||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
// ignore signals sent to the parent (e.g. SIGINT)
|
// ignore signals sent to the parent (e.g. SIGINT)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
cmd.SysProcAttr = &sysProcAttr
|
||||||
|
|
||||||
// get stdin and stdout
|
// get stdin and stdout
|
||||||
wr, err := cmd.StdinPipe()
|
wr, err := cmd.StdinPipe()
|
||||||
|
12
backend/sftp/sftp_unix.go
Normal file
12
backend/sftp/sftp_unix.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package sftp
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// ignore signals sent to the parent (e.g. SIGINT)
|
||||||
|
sysProcAttr = syscall.SysProcAttr{Setsid: true}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user