{"action":"created","issue":{"url":"https://api.github.com/repos/electron/electron/issues/13254","repository_url":"https://api.github.com/repos/electron/electron","labels_url":"https://api.github.com/repos/electron/electron/issues/13254/labels{/name}","comments_url":"https://api.github.com/repos/electron/electron/issues/13254/comments","events_url":"https://api.github.com/repos/electron/electron/issues/13254/events","html_url":"https://github.com/electron/electron/issues/13254","id":332704343,"node_id":"MDU6SXNzdWUzMzI3MDQzNDM=","number":13254,"title":"SIGPIPE crash when accessing stdin of badly spawned process","user":{"login":"joaomoreno","id":22350,"node_id":"MDQ6VXNlcjIyMzUw","avatar_url":"https://avatars3.githubusercontent.com/u/22350?v=4","gravatar_id":"","url":"https://api.github.com/users/joaomoreno","html_url":"https://github.com/joaomoreno","followers_url":"https://api.github.com/users/joaomoreno/followers","following_url":"https://api.github.com/users/joaomoreno/following{/other_user}","gists_url":"https://api.github.com/users/joaomoreno/gists{/gist_id}","starred_url":"https://api.github.com/users/joaomoreno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaomoreno/subscriptions","organizations_url":"https://api.github.com/users/joaomoreno/orgs","repos_url":"https://api.github.com/users/joaomoreno/repos","events_url":"https://api.github.com/users/joaomoreno/events{/privacy}","received_events_url":"https://api.github.com/users/joaomoreno/received_events","type":"User","site_admin":false},"labels":[{"id":520323169,"node_id":"MDU6TGFiZWw1MjAzMjMxNjk=","url":"https://api.github.com/repos/electron/electron/labels/bug%20:beetle:","name":"bug :beetle:","color":"fbca04","default":false},{"id":97403642,"node_id":"MDU6TGFiZWw5NzQwMzY0Mg==","url":"https://api.github.com/repos/electron/electron/labels/platform/linux","name":"platform/linux","color":"c7def8","default":false},{"id":839475038,"node_id":"MDU6TGFiZWw4Mzk0NzUwMzg=","url":"https://api.github.com/repos/electron/electron/labels/version/2.0.x","name":"version/2.0.x","color":"bfdadc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-06-15T09:23:22Z","updated_at":"2018-08-16T14:02:07Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"* Electron Version: 2.0.2\r\n* Operating System (Platform and Version): Arch Linux up-to-date\r\n* Last known working Electron version: ?\r\n\r\n**Expected Behavior**\r\n\r\n```script.js\r\nvar child_process = require(\"child_process\");\r\nvar spawn = child_process.spawn;\r\nvar child = spawn('randomprocesswhichdoesnotexist', []);\r\nchild.on('error', () => console.log('got error'));\r\nchild.stdin.end('');\r\nconsole.log('got to the end!');\r\n```\r\n\r\nWhen running this script with Node 8.9.3, everything works as expected:\r\n\r\n```\r\n$ node ~/Desktop/script.js                                             \r\ngot to the end!\r\ngot error\r\n```\r\n\r\nI expected this to run the same with Electron 2.0.2 and `ELECTRON_RUN_AS_NODE`.\r\n\r\n**Actual behavior**\r\n\r\nInstead this is the outcome:\r\n\r\n```\r\n$ ELECTRON_RUN_AS_NODE=1 ./.build/electron/code-oss ~/Desktop/script.js\r\n$ echo $?\r\n141\r\n```\r\n\r\nWhen using GDB, you'll notice a `SIGPIPE` error which likely causes Electron to crash:\r\n\r\n```\r\n$ ELECTRON_RUN_AS_NODE=1 gdb --args ./.build/electron/code-oss ~/Desktop/script.js\r\nGNU gdb (GDB) 8.1\r\nCopyright (C) 2018 Free Software Foundation, Inc.\r\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\r\nThis is free software: you are free to change and redistribute it.\r\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\r\nand \"show warranty\" for details.\r\nThis GDB was configured as \"x86_64-pc-linux-gnu\".\r\nType \"show configuration\" for configuration details.\r\nFor bug reporting instructions, please see:\r\n<http://www.gnu.org/software/gdb/bugs/>.\r\nFind the GDB manual and other documentation resources online at:\r\n<http://www.gnu.org/software/gdb/documentation/>.\r\nFor help, type \"help\".\r\nType \"apropos word\" to search for commands related to \"word\"...\r\nReading symbols from ./.build/electron/code-oss...(no debugging symbols found)...done.\r\n(gdb) r\r\nStarting program: /home/joao/Work/vscode/.build/electron/code-oss /home/joao/Desktop/script.js\r\n[Thread debugging using libthread_db enabled]\r\nUsing host libthread_db library \"/usr/lib/libthread_db.so.1\".\r\n[New Thread 0x7fffe7932700 (LWP 25373)]\r\n[New Thread 0x7fffe7131700 (LWP 25374)]\r\n[New Thread 0x7fffe6930700 (LWP 25375)]\r\n[New Thread 0x7fffe612f700 (LWP 25376)]\r\n\r\nThread 1 \"code-oss\" received signal SIGPIPE, Broken pipe.\r\n0x00007ffff68f9447 in write () from /usr/lib/libpthread.so.0\r\n(gdb) q\r\nA debugging session is active.\r\n\r\n\tInferior 1 [process 25369] will be killed.\r\n\r\nQuit anyway? (y or n) y\r\n```\r\n\r\n**To Reproduce**\r\n\r\nSimply create that file and run it as mentioned above.\r\n\r\n**Additional Information**\r\n\r\nThis affects https://github.com/Microsoft/vscode/issues/51750\r\n"},"comment":{"url":"https://api.github.com/repos/electron/electron/issues/comments/413556184","html_url":"https://github.com/electron/electron/issues/13254#issuecomment-413556184","issue_url":"https://api.github.com/repos/electron/electron/issues/13254","id":413556184,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzU1NjE4NA==","user":{"login":"bpasero","id":900690,"node_id":"MDQ6VXNlcjkwMDY5MA==","avatar_url":"https://avatars3.githubusercontent.com/u/900690?v=4","gravatar_id":"","url":"https://api.github.com/users/bpasero","html_url":"https://github.com/bpasero","followers_url":"https://api.github.com/users/bpasero/followers","following_url":"https://api.github.com/users/bpasero/following{/other_user}","gists_url":"https://api.github.com/users/bpasero/gists{/gist_id}","starred_url":"https://api.github.com/users/bpasero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpasero/subscriptions","organizations_url":"https://api.github.com/users/bpasero/orgs","repos_url":"https://api.github.com/users/bpasero/repos","events_url":"https://api.github.com/users/bpasero/events{/privacy}","received_events_url":"https://api.github.com/users/bpasero/received_events","type":"User","site_admin":false},"created_at":"2018-08-16T14:02:07Z","updated_at":"2018-08-16T14:02:07Z","author_association":"CONTRIBUTOR","body":"The only workaround we have for VSCode is this piece of code:\r\n\r\n```javascript\r\nprocess.on('SIGPIPE', () => {\r\n   console.log(\"No, please do not exit...\");\r\n});\r\n```"}}
{"actor":{"display_login":"bpasero"}}