Skip to content
New issue

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

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

Already on GitHub? # to your account

[Marked CLI] ^C causes manpage error #2706

Closed
LeoDog896 opened this issue Jan 11, 2023 · 2 comments · Fixed by #3483
Closed

[Marked CLI] ^C causes manpage error #2706

LeoDog896 opened this issue Jan 11, 2023 · 2 comments · Fixed by #3483
Labels
category: cli good first issue Something easy to get started with

Comments

@LeoDog896
Copy link
Contributor

LeoDog896 commented Jan 11, 2023

Marked version:
master branch. Tested on commit d28cc87, but is also reproducible on the stable 4.2.5 version.

Describe the bug
The CTRL + C signal is never sent to the man command, causing the following error:

OAman: command exited with status 1: sed -e '/^[[:space:]]*$/{ N; /^[[:space:]]*\n[[:space:]]*$/D; }' | LESS=-ix8RmPm Manual page marked\.1 ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page marked\.1 ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$ MAN_PN=marked\.1 pager

bash: OA: command not found

To Reproduce
Run marked --help, and once the manpage opens, press CTRL + C (^C).

Expected behavior
Marked CLI should either:

  • Let man handle SIGINT (tested locally, if it does this then it safely exits without a newline printed)
  • Don't accept SIGINT at all (man pages are supposed to not exit when a SIGINT signal is sent whatsoever.)

By the way, I'm fully open to fixing it, but I'm unsure about which one of the two behaviors above (or some other behavior) would be preferred.

@UziTech
Copy link
Member

UziTech commented Jan 11, 2023

I'm ok with either. Option 1 sounds right to me. Where did you get the information that man pages are supposed to not exit when a SIGINT signal is sent whatsoever.?

@LeoDog896
Copy link
Contributor Author

LeoDog896 commented Jan 11, 2023

I actually don't know where I got that from (unixexchange question), but the man command uses less in the background, which requires an explicit flag to listen to CTRL + C: --quit-on-intr. However, in the case of subprocesses, it seems that man handles CTRL + C quite fine (and lines up with the expected CLI behavior) -- I'll make a PR for it shortly.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
category: cli good first issue Something easy to get started with
Projects
None yet
2 participants