Skip to content

Commit 3b75fa1

Browse files
[WIP] Lock file must be deleted when user trigger a sigint through ctrl-c (#137)
* Initial plan * Fix lock file cleanup on SIGINT and improve stale lock handling Co-authored-by: paolomainardi <8747+paolomainardi@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: paolomainardi <8747+paolomainardi@users.noreply.github.com>
1 parent efa1b8e commit 3b75fa1

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

bin/sparkdock.macos

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ cleanup_lock() {
3030
fi
3131
}
3232

33-
# Set up trap at the start to catch all exits
34-
trap cleanup_lock EXIT
33+
# Set up trap at the start to catch all exits and interruptions
34+
trap cleanup_lock EXIT INT TERM
3535

3636
check_for_updates() {
3737
cd "$SPARKDOCK_ROOT"
@@ -66,9 +66,8 @@ check_for_updates() {
6666
exit 1
6767
else
6868
print_warning "Lock file exists but the process (PID: $pid) is no longer running."
69-
print_warning "If you believe this is a stale lock file, you can remove it manually by running:"
70-
print_warning " rm -f $LOCK_FILE"
71-
exit 1
69+
print_warning "Removing stale lock file and continuing..."
70+
rm -f "$LOCK_FILE"
7271
fi
7372
fi
7473
echo $$ > "$LOCK_FILE"

0 commit comments

Comments
 (0)