{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/22053","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/22053/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/22053/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/22053/events","html_url":"https://github.com/nodejs/node/issues/22053","id":346450550,"node_id":"MDU6SXNzdWUzNDY0NTA1NTA=","number":22053,"title":"child_process.spawn does not receive SIGINT.","user":{"login":"heroboy","id":54468,"node_id":"MDQ6VXNlcjU0NDY4","avatar_url":"https://avatars0.githubusercontent.com/u/54468?v=4","gravatar_id":"","url":"https://api.github.com/users/heroboy","html_url":"https://github.com/heroboy","followers_url":"https://api.github.com/users/heroboy/followers","following_url":"https://api.github.com/users/heroboy/following{/other_user}","gists_url":"https://api.github.com/users/heroboy/gists{/gist_id}","starred_url":"https://api.github.com/users/heroboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heroboy/subscriptions","organizations_url":"https://api.github.com/users/heroboy/orgs","repos_url":"https://api.github.com/users/heroboy/repos","events_url":"https://api.github.com/users/heroboy/events{/privacy}","received_events_url":"https://api.github.com/users/heroboy/received_events","type":"User","site_admin":false},"labels":[{"id":592511284,"node_id":"MDU6TGFiZWw1OTI1MTEyODQ=","url":"https://api.github.com/repos/nodejs/node/labels/wrong%20repo","name":"wrong repo","color":"e94645","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-01T05:12:24Z","updated_at":"2018-08-07T07:43:56Z","closed_at":"2018-08-01T05:38:55Z","author_association":"NONE","body":"* **Version**:v10.4.0\r\n* **Platform**:Microsoft Windows [Version 10.0.17134.191]\r\n\r\ntestspawn.js: create a child process `node child`\r\n```javascript\r\nvar child_process = require('child_process');\r\n\r\nvar childprocess = child_process.spawn('node', ['child'], { cwd: __dirname, shell: true, detached: true, stdio: 'ignore' });\r\n\r\nchildprocess.on('exit', e =>\r\n{\r\n\tconsole.log('child is exit')\r\n});\r\n```\r\nchild.js: listen SIGINT to exit the program\r\n```javascript\r\nvar repl = require('repl')\r\nvar count = 0;\r\nvar interval = setInterval(function ()\r\n{\r\n\tconsole.log(`count = ${count++}`);\r\n}, 500)\r\n\r\nprocess.on('SIGINT', () =>\r\n{\r\n\tconsole.log('sigint exit');\r\n\tclearInterval(interval);\r\n})\r\n\r\nprocess.on('SIGBREAK',()=>{\r\n\tconsole.log('sigbreak exit');\r\n\tclearInterval(interval);\r\n})\r\nrepl.start();\r\n```\r\nRun the `testspawn.js` , I can't use Ctrl+C to exit the program, only Ctrl+Break works. When Ctrl+C pressed or enter `.exit`, the `repl` would stop working.\r\n\r\nI don't it is an intend feature, or I pass the wrong paramters of spawn function."},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/410965413","html_url":"https://github.com/nodejs/node/issues/22053#issuecomment-410965413","issue_url":"https://api.github.com/repos/nodejs/node/issues/22053","id":410965413,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDk2NTQxMw==","user":{"login":"heroboy","id":54468,"node_id":"MDQ6VXNlcjU0NDY4","avatar_url":"https://avatars0.githubusercontent.com/u/54468?v=4","gravatar_id":"","url":"https://api.github.com/users/heroboy","html_url":"https://github.com/heroboy","followers_url":"https://api.github.com/users/heroboy/followers","following_url":"https://api.github.com/users/heroboy/following{/other_user}","gists_url":"https://api.github.com/users/heroboy/gists{/gist_id}","starred_url":"https://api.github.com/users/heroboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heroboy/subscriptions","organizations_url":"https://api.github.com/users/heroboy/orgs","repos_url":"https://api.github.com/users/heroboy/repos","events_url":"https://api.github.com/users/heroboy/events{/privacy}","received_events_url":"https://api.github.com/users/heroboy/received_events","type":"User","site_admin":false},"created_at":"2018-08-07T07:43:56Z","updated_at":"2018-08-07T07:43:56Z","author_association":"NONE","body":"hi @mscdex, why this is wrong repo? I think I was reporting the issue of nodejs core lib \"child_process\".\r\nI just wrote a c++ program as the child process that spawned by nodejs. It couldn't receive the `Ctrl+C` event. The c++ program uses `SetConsoleCtrlHandler` listen to the event, if it runs directly from command line, it will receive Ctrl+C event. But when it is spawn by nodes, it doesn't."}}
{"actor":{"display_login":"heroboy"}}