mirror of
https://github.com/rclone/rclone.git
synced 2025-01-09 15:58:28 +01:00
lib/atexit: fix occasional failure to unmount with CTRL-C #4957
Before this change CTRL-C could come in to exit rclone which would start the atexit actions running. The Fuse unmount then signals rclone to exit which wasn't waiting for the already running atexit actions to complete. This change makes sure that if the atexit actions are started they should be completed.
This commit is contained in:
parent
e3e08a48cb
commit
8d847a4e94
@ -77,9 +77,10 @@ func IgnoreSignals() {
|
||||
|
||||
// Run all the at exit functions if they haven't been run already
|
||||
func Run() {
|
||||
// Take the lock here so we wait until all have run before returning
|
||||
fnsMutex.Lock()
|
||||
defer fnsMutex.Unlock()
|
||||
exitOnce.Do(func() {
|
||||
fnsMutex.Lock()
|
||||
defer fnsMutex.Unlock()
|
||||
for fnHandle := range fns {
|
||||
(*fnHandle)()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user