Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGINT trapped in macOS #142

Open
atombender opened this issue Jul 4, 2024 · 1 comment
Open

SIGINT trapped in macOS #142

atombender opened this issue Jul 4, 2024 · 1 comment

Comments

@atombender
Copy link

atombender commented Jul 4, 2024

I have a recurring problem with SIGINT being ignored in my shells, which I've been able to narrow down to zsh-histdb. Everything works as expected, except ctrl-c suddenly stops working in the shell. Executing trap INT {} restores the normal behaviour until it happens again. It's sporadic, but I can reproduce it very easily in about 5 seconds immediately after starting a shell.

I was using histdb for years before this showed up, but I can't pinpoint when it did. I've been able to reproduce this with a clean environment and only zsh-histdb, so this is definitely the cause.

I've not been able to reproduce it in the macOS Terminal.app, which is interesting, only in iTerm.

It sounds similar to #83, but probably something different.

Environment

  • Latest version (90a6c10).
  • SQLite shipped with macOS (3.43.2 right now) or latest version 3.46.0 via Homebrew.
  • iTerm 3.5.3
@atombender
Copy link
Author

I added an explicit trap, and have not seen the issue since. Not sure if this is the best fix, though:

$ git diff
diff --git a/sqlite-history.zsh b/sqlite-history.zsh
index c534918..dafe309 100644
--- a/sqlite-history.zsh
+++ b/sqlite-history.zsh
@@ -53,6 +53,7 @@ _histdb_start_sqlite_pipe () {
     local PIPE==(<<<'')
     setopt local_options no_notify no_monitor
     mkfifo $PIPE
+    TRAPINT() { return 1 }
     sqlite3 -batch -noheader "${HISTDB_FILE}" < $PIPE >/dev/null &|
     sysopen -w -o cloexec -u HISTDB_FD -- $PIPE
     command rm $PIPE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant