Shell return code is set in odd places

RESOLVED FIXED in Firefox 40

Status

()

Core
JavaScript Engine
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: billm, Assigned: billm)

Tracking

Trunk
mozilla40
x86_64
Linux
Points:
---

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(1 attachment)

Created attachment 8588719 [details] [diff] [review]
patch

For some reason, certain errors in shell builtins cause us to set gExitCode. Even if the exception is caught and handled, gExitCode remains set and so we return a non-zero code on exit. I've been writing some command line JS code recently and this is really annoying. I looked through the blame and I can't find any reason it works this way.
Attachment #8588719 - Flags: review?(sphink)
Comment on attachment 8588719 [details] [diff] [review]
patch

Review of attachment 8588719 [details] [diff] [review]:
-----------------------------------------------------------------

Wow, what a mess. Yet another error reporting mechanism. It seems like there ought to be a comment somewhere, but I'm not sure where.

AFAICT, the rule should be that if you're returning false without setting an exception, you can set gExitCode if you'd like a more specific exit code than EXITCODE_RUNTIME_ERROR. The two you removed may have been cargo-culted, or just random stabs at Doing The Right Thing.
Attachment #8588719 - Flags: review?(sphink) → review+
https://hg.mozilla.org/mozilla-central/rev/830f6535aced
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox40: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.