2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

Merge pull request #3696 from cqjjjzr/fix-win-procgrp

Fix rclone (scoop shim) and sftp issue due to detached console on Windows
This commit is contained in:
Alexander Neumann 2022-04-03 13:46:28 +02:00 committed by GitHub
commit 192288bc9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,12 @@
Bugfix: Fix rclone (shimmed by Scoop) and sftp stopped working on Windows
In #3602 a fix was introduced to fix the problem that rclone prematurely exits
when Ctrl+C is pressed on Windows. The solution was to create the subprocess
with its console detached from the restic console. However, such solution
fails when using rclone install by scoop or using sftp with a passphrase-
protected private key. We've fixed that by using a different approach to prevent
Ctrl-C from passing down too early.
https://github.com/restic/restic/issues/3681
https://github.com/restic/restic/issues/3692
https://github.com/restic/restic/pull/3696

View File

@ -11,7 +11,7 @@ import (
func startForeground(cmd *exec.Cmd) (bg func() error, err error) {
// just start the process and hope for the best
cmd.SysProcAttr = &syscall.SysProcAttr{}
cmd.SysProcAttr.CreationFlags = windows.DETACHED_PROCESS
cmd.SysProcAttr.CreationFlags = windows.CREATE_NEW_PROCESS_GROUP
err = cmd.Start()
if err != nil {
return nil, errors.Wrap(err, "cmd.Start")