Browse Source

fix: kill SIGINT signal at man for marked --help (#3483)

Lucas Terracino 10 tháng trước cách đây
mục cha
commit
b1fd3eafd8
1 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 8 4
      bin/main.js

+ 8 - 4
bin/main.js

@@ -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);
     });
   }