mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-08 16:23:42 -04:00
ctrl-c must not kill other subprocesses, fixes #6912
There are some other places with subprocesses: - borg create --content-from-command - borg create --paths-from-command - (de)compression filter process of import-tar / export-tar
This commit is contained in:
parent
5d83d5f153
commit
7a31978c55
2 changed files with 5 additions and 5 deletions
|
|
@ -73,7 +73,7 @@ try:
|
|||
from .helpers import umount
|
||||
from .helpers import flags_root, flags_dir, flags_special_follow, flags_special
|
||||
from .helpers import msgpack
|
||||
from .helpers import sig_int
|
||||
from .helpers import sig_int, ignore_sigint
|
||||
from .helpers import iter_separated
|
||||
from .helpers import get_tar_filter
|
||||
from .nanorst import rst_to_terminal
|
||||
|
|
@ -527,7 +527,7 @@ class Archiver:
|
|||
if not dry_run:
|
||||
try:
|
||||
try:
|
||||
proc = subprocess.Popen(args.paths, stdout=subprocess.PIPE)
|
||||
proc = subprocess.Popen(args.paths, stdout=subprocess.PIPE, preexec_fn=ignore_sigint)
|
||||
except (FileNotFoundError, PermissionError) as e:
|
||||
self.print_error('Failed to execute command: %s', e)
|
||||
return self.exit_code
|
||||
|
|
@ -546,7 +546,7 @@ class Archiver:
|
|||
paths_sep = eval_escapes(args.paths_delimiter) if args.paths_delimiter is not None else '\n'
|
||||
if args.paths_from_command:
|
||||
try:
|
||||
proc = subprocess.Popen(args.paths, stdout=subprocess.PIPE)
|
||||
proc = subprocess.Popen(args.paths, stdout=subprocess.PIPE, preexec_fn=ignore_sigint)
|
||||
except (FileNotFoundError, PermissionError) as e:
|
||||
self.print_error('Failed to execute command: %s', e)
|
||||
return self.exit_code
|
||||
|
|
|
|||
|
|
@ -328,10 +328,10 @@ def create_filter_process(cmd, stream, stream_close, inbound=True):
|
|||
# for us to do something while we block on the process for something different.
|
||||
if inbound:
|
||||
proc = popen_with_error_handling(cmd, stdout=subprocess.PIPE, stdin=filter_stream,
|
||||
log_prefix='filter-process: ', env=env)
|
||||
log_prefix='filter-process: ', env=env, preexec_fn=ignore_sigint)
|
||||
else:
|
||||
proc = popen_with_error_handling(cmd, stdin=subprocess.PIPE, stdout=filter_stream,
|
||||
log_prefix='filter-process: ', env=env)
|
||||
log_prefix='filter-process: ', env=env, preexec_fn=ignore_sigint)
|
||||
if not proc:
|
||||
raise Error(f'filter {cmd}: process creation failed')
|
||||
stream = proc.stdout if inbound else proc.stdin
|
||||
|
|
|
|||
Loading…
Reference in a new issue