qownnotes / qc

QOwnNotes command-line snippet manager.

Home Page:https://www.qownnotes.org/getting-started/command-line-snippet-manager.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

responding to SIGINT

euneuber opened this issue · comments

Thanks for this great tool!

I'd like to make a small suggestion:

  • on [Ctrl]-C (SIGINT) an exit code of 128 + signal number = 130 should be returned (see man 1 bash in "SHELL GRAMMAR" / "Simple Commands" for reference)
  • on [Ctrl]-C (SIGINT) do not put any ouput on terminal.

Thank you for your kind words (and the first like). 😁

What are we talking about? What do you want to quit with Ctrl + C? fzf?

Yes, qc starts fzf so SIGINT terminates fzf and it already responds with exit code 130 (one can start fzf alone in a terminal and press [Ctrl]-C followed by echo $?)

And you want that this exit code is passed through by qc when exiting?

And what do you want to achieve by this?

It should already be returned by:

qc/cmd/exec.go

Line 41 in 9cb2c1c

return run(command, os.Stdin, os.Stdout)

But it doesn't seem to be returned by Cobra:

qc/cmd/exec.go

Lines 14 to 20 in 9cb2c1c

// execCmd represents the exec command
var execCmd = &cobra.Command{
Use: "exec",
Short: "Run the selected commands",
Long: `Run the selected commands directly`,
RunE: execute,
}

You can play around with it if you like...

Yes, qc starts fzf so SIGINT terminates fzf and it already responds with exit code 130 (one can start fzf alone in a terminal and press [Ctrl]-C followed by echo $?)

Let me know if you find a way to pass the exit code on...