mirror of https://github.com/borgbackup/borg.git
Merge pull request #2102 from enkore/issue/2082
mount: umount on SIGINT/^C when in foreground
This commit is contained in:
commit
127250c400
|
@ -1546,6 +1546,13 @@ class Archiver:
|
|||
- allow_damaged_files: by default damaged files (where missing chunks were
|
||||
replaced with runs of zeros by borg check --repair) are not readable and
|
||||
return EIO (I/O error). Set this option to read such files.
|
||||
|
||||
When the daemonized process receives a signal or crashes, it does not unmount.
|
||||
Unmounting in these cases could cause an active rsync or similar process
|
||||
to unintentionally delete data.
|
||||
|
||||
When running in the foreground ^C/SIGINT unmounts cleanly, but other
|
||||
signals or crashes do not.
|
||||
""")
|
||||
subparser = subparsers.add_parser('mount', parents=[common_parser],
|
||||
description=self.do_mount.__doc__,
|
||||
|
|
|
@ -6,6 +6,7 @@ import os
|
|||
import stat
|
||||
import tempfile
|
||||
import time
|
||||
from signal import SIGINT
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
import msgpack
|
||||
|
@ -98,7 +99,8 @@ class FuseOperations(llfuse.Operations):
|
|||
umount = False
|
||||
try:
|
||||
signal = fuse_main()
|
||||
umount = (signal is None) # no crash and no signal -> umount request
|
||||
# no crash and no signal (or it's ^C and we're in the foreground) -> umount request
|
||||
umount = (signal is None or (signal == SIGINT and foreground))
|
||||
finally:
|
||||
llfuse.close(umount)
|
||||
|
||||
|
|
Loading…
Reference in New Issue