Skip to content

Replace global return with process.exit(1)#33

Open
asdofindia wants to merge 2 commits intobalderdashy:masterfrom
asdofindia:patch-1
Open

Replace global return with process.exit(1)#33
asdofindia wants to merge 2 commits intobalderdashy:masterfrom
asdofindia:patch-1

Conversation

@asdofindia
Copy link
Copy Markdown

ESlint fails with "parsing error return outside function" because of this return. Alternative is to use process.exit.

ESlint fails with "parsing error return outside function" because of this return. Alternative is to use process.exit.
@mikermcneil
Copy link
Copy Markdown
Member

@asdofindia thanks! I can dig it-- although what I'm not sure about offhand is if there is ever a scenario where process.exit(1) will not necessarily halt execution within the current file-- i.e. I don't know for certain whether or not we'd still potentially want the return to prevent line 54 from being run in a weird scenario (e.g. where someone has a custom process on exit listener bound)

I'm pretty sure that used to be something you had to worry about back in the node <4 days-- I just haven't gotten into the weeds with it for a while. Any ideas?

@mikermcneil
Copy link
Copy Markdown
Member

Or... actually, much easier: We could also just throw instead of logging err.stack above. That'd kill two birds with one stone, i think (though it would take some fiddling with the error we throw to make the output look nice)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants