Skip to content

Commit

Permalink
fix: kill SIGINT signal at man for marked --help
Browse files Browse the repository at this point in the history
  • Loading branch information
NOMADE55 committed Oct 14, 2024
1 parent 2898bf0 commit ec3abd8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ export async function main(nodeProcess) {
const helpText = await readFile(resolve(__dirname, '../man/marked.1.md'), 'utf8');

await new Promise(res => {
spawn('man', [resolve(__dirname, '../man/marked.1')], options)
.on('error', () => {
console.log(helpText);
})
const manProcess = spawn('man', [resolve(__dirname, '../man/marked.1')], options);
nodeProcess.on('SIGINT', () => {
manProcess.kill('SIGINT');
});

manProcess.on('error', () => {
console.log(helpText);
})
.on('close', res);
});
}
Expand Down

0 comments on commit ec3abd8

Please sign in to comment.