{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/3617","labels_url":"https://api.github.com/repos/nodejs/node/issues/3617/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/3617/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/3617/events","html_url":"https://github.com/nodejs/node/issues/3617","id":114435736,"number":3617,"title":"process.kill can't kill process group on Windows","user":{"login":"kflu","id":1031978,"avatar_url":"https://avatars.githubusercontent.com/u/1031978?v=3","gravatar_id":"","url":"https://api.github.com/users/kflu","html_url":"https://github.com/kflu","followers_url":"https://api.github.com/users/kflu/followers","following_url":"https://api.github.com/users/kflu/following{/other_user}","gists_url":"https://api.github.com/users/kflu/gists{/gist_id}","starred_url":"https://api.github.com/users/kflu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kflu/subscriptions","organizations_url":"https://api.github.com/users/kflu/orgs","repos_url":"https://api.github.com/users/kflu/repos","events_url":"https://api.github.com/users/kflu/events{/privacy}","received_events_url":"https://api.github.com/users/kflu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/process","name":"process","color":"00aaff"},{"url":"https://api.github.com/repos/nodejs/node/labels/windows","name":"windows","color":"9944dd"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-31T21:33:35Z","updated_at":"2015-11-02T19:05:12Z","closed_at":null,"body":"Per [process.kill doc](https://nodejs.org/api/process.html#process_process_kill_pid_signal), it \"Send a signal to **a** process\". That indicates the API is intended to be used against a single process. However, it then refers to [kill(2) man page][1], which states that the API can also be used against a process group, when `pid < -1`. On Windows, it clearly doesn't support the `pid < -1` case. \r\n\r\nNode.js is intended to provide a consistent bahavior as much as possible for cross-platform developing. That means either this support should be added for Windows, or document should be updated and warns developers on the usage.\r\n\r\nSee Unitech/pm2/issues/1664 for more detail.\r\n\r\n```\r\n> var x = child_process.exec('notepad');\r\nundefined\r\n> x.pid\r\n3040\r\n> process.kill(-x.pid)\r\nError: kill ESRCH\r\n    at exports._errnoException (util.js:874:11)\r\n    at process.kill (node.js:774:15)\r\n    at repl:1:9\r\n    at REPLServer.defaultEval (repl.js:164:27)\r\n    at bound (domain.js:280:14)\r\n    at REPLServer.runBound [as eval] (domain.js:293:12)\r\n    at REPLServer.<anonymous> (repl.js:393:12)\r\n    at emitOne (events.js:82:20)\r\n    at REPLServer.emit (events.js:169:7)\r\n    at REPLServer.Interface._onLine (readline.js:210:10)\r\n```\r\n\r\n[1]: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAAahUKEwic7Ovc0-3IAhUQ3GMKHajtABU&url=http%3A%2F%2Flinux.die.net%2Fman%2F2%2Fkill&usg=AFQjCNF7UvxdWGS7UqFYhevXVNkjp8zykw&sig2=N8IE71uYPK42Qf_GPnBqAA"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/153126223","html_url":"https://github.com/nodejs/node/issues/3617#issuecomment-153126223","issue_url":"https://api.github.com/repos/nodejs/node/issues/3617","id":153126223,"user":{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars.githubusercontent.com/u/275871?v=3","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"created_at":"2015-11-02T19:05:12Z","updated_at":"2015-11-02T19:05:12Z","body":"> Windows does have process groups and is capable of sending signals to the group.\r\n\r\nWindows process groups are a pale shadow of UNIX process groups: you cannot send arbitrary signals, only C-Break.  Job objects come closer in some ways but still not close enough.\r\n\r\nHacking in support for either is not worth the effort IMO.  You're welcome to try though."}}