[SERVER-8020] Shell exits with successful return code upon failure Created: 23/Dec/12 Updated: 11/Jul/16 Resolved: 24/Jun/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | 2.5.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ben McCann | Assignee: | Tad Marshall |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Participants: |
| Description |
|
If I run a command with a bad username and password as shown below, the shill prints an error message, but returns with a successful return code. This makes it difficult to detect an error when executing the shell from another script. E.g. I have a script which uses the shell to lock the database, take a backup, and unlock the database and I'd like to detect an error with the bad username or password. $ mongo -u myuser -p badpassword mydatastore --eval "printjson(db.fsyncLock())" |
| Comments |
| Comment by Tad Marshall [ 24/Jun/13 ] | |||||||||||||
|
I tested the current master (2.5.1-pre-) and it behaves as requested here: the return code is set to 1 when authentication from the mongo shell command line fails. With correct password
With incorrect password
|