{"action":"created","issue":{"url":"https://api.github.com/repos/npm/npm/issues/14339","repository_url":"https://api.github.com/repos/npm/npm","labels_url":"https://api.github.com/repos/npm/npm/issues/14339/labels{/name}","comments_url":"https://api.github.com/repos/npm/npm/issues/14339/comments","events_url":"https://api.github.com/repos/npm/npm/issues/14339/events","html_url":"https://github.com/npm/npm/issues/14339","id":183997951,"number":14339,"title":"npm run-script exit code is always 0","user":{"login":"stevenvachon","id":170197,"avatar_url":"https://avatars.githubusercontent.com/u/170197?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenvachon","html_url":"https://github.com/stevenvachon","followers_url":"https://api.github.com/users/stevenvachon/followers","following_url":"https://api.github.com/users/stevenvachon/following{/other_user}","gists_url":"https://api.github.com/users/stevenvachon/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenvachon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenvachon/subscriptions","organizations_url":"https://api.github.com/users/stevenvachon/orgs","repos_url":"https://api.github.com/users/stevenvachon/repos","events_url":"https://api.github.com/users/stevenvachon/events{/privacy}","received_events_url":"https://api.github.com/users/stevenvachon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-19T15:37:40Z","updated_at":"2016-10-19T19:23:56Z","closed_at":null,"body":"```json\r\n\"scripts\": {\r\n  \"build\": \"cmd; echo $?\"\r\n}\r\n```\r\nThis exits with and echoes 1:\r\n```shell\r\ncmd; echo $1\r\n```\r\nWhile this exits with and echoes 0:\r\n```shell\r\nnpm run build\r\n```"},"comment":{"url":"https://api.github.com/repos/npm/npm/issues/comments/254914652","html_url":"https://github.com/npm/npm/issues/14339#issuecomment-254914652","issue_url":"https://api.github.com/repos/npm/npm/issues/14339","id":254914652,"user":{"login":"AlexTes","id":2011351,"avatar_url":"https://avatars.githubusercontent.com/u/2011351?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexTes","html_url":"https://github.com/AlexTes","followers_url":"https://api.github.com/users/AlexTes/followers","following_url":"https://api.github.com/users/AlexTes/following{/other_user}","gists_url":"https://api.github.com/users/AlexTes/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexTes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexTes/subscriptions","organizations_url":"https://api.github.com/users/AlexTes/orgs","repos_url":"https://api.github.com/users/AlexTes/repos","events_url":"https://api.github.com/users/AlexTes/events{/privacy}","received_events_url":"https://api.github.com/users/AlexTes/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T19:23:56Z","updated_at":"2016-10-19T19:23:56Z","body":"Okay, so if `\"build\": \"cmd; echo $?\"` does output 1, it is quite peculiar.\r\nThe [npm docs](https://docs.npmjs.com/misc/scripts#exiting) say this:\r\n\r\n> Scripts are run by passing the line as a script argument to sh.\r\n> If the script exits with a code other than 0, then this will abort the process.\r\n\r\nSo if `bash -c cmd` or in case it's a file `bash cmd` exits with a 1, someone with more in-depth knowledge than me would have to take over. Use `echo $?` _after_ executing the line I just mentioned to check the exit code. Adding `echo $?` to the line itself complicates things.\r\n"}}
{"actor":{"display_login":"AlexTes"}}