aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/main.go b/main.go
index 811a2c6..ac2d894 100644
--- a/main.go
+++ b/main.go
@@ -1829,9 +1829,8 @@ func cmdSync(args []string) error {
return err
}
- // TODO: See if the SQLite can cancel anything in a useful manner.
- // If using this, beware that a cancel prevents commiting transactions.
- ctx := context.Background()
+ ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
+ defer stop()
// In case of a failure during processing, the only retained side effects
// on the filesystem tree are:
@@ -1850,11 +1849,6 @@ func cmdSync(args []string) error {
return err
}
- // XXX: By not using the context for the transaction,
- // interrupts can get ignored around the Commit.
- ctxSignal, stop := signal.NotifyContext(ctx, os.Interrupt)
- defer stop()
-
// Normalize arguments.
// At least for now, turn all roots into absolute paths.
roots := args[1:]
@@ -1875,7 +1869,7 @@ func cmdSync(args []string) error {
return true
})
- if err := syncRun(ctxSignal, tx, roots); err != nil {
+ if err := syncRun(ctx, tx, roots); err != nil {
return err
}
return tx.Commit()