Closed Bug 1151583 Opened 9 years ago Closed 9 years ago

Shell return code is set in odd places

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: billm, Assigned: billm)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
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
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: