[SERVER-2095] console returning an error for lines terminated in equals (=) Created: 15/Nov/10 Updated: 12/Jul/16 Resolved: 06/Dec/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | 1.6.3, 1.6.4 |
| Fix Version/s: | 1.7.4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Justin Dearing | Assignee: | Tony Hannan |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 7 |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
If I put the following jacascript in the console: ); ); ); Expected behavior of the shell would be to hold the line ending in equals in a buffer and append the next line to it before executing. |
| Comments |
| Comment by auto [ 06/Dec/10 ] |
|
Author: {'login': 'TonyGen', 'name': 'Tony Hannan', 'email': 'tony@10gen.com'}Message: |
| Comment by Tony Hannan [ 06/Dec/10 ] |
|
Shell now requests another line when user enters a line with a dangling operator. Eg. 'x = 1 +' will request more input. |
| Comment by auto [ 06/Dec/10 ] |
|
Author: {'login': 'TonyGen', 'name': 'Tony Hannan', 'email': 'tony@10gen.com'}Message: |
| Comment by Kristina Chodorow (Inactive) [ 30/Nov/10 ] |
|
Rhino precedent: js> x= |
| Comment by Justin Dearing [ 30/Nov/10 ] |
|
Mongo will buffer if you have unmatched ", ', (, {, or [ characters so why not the same for an equals sign. So it seems a reasonable expectation to do the same with a line terminated by a binary operator. As far as behavior matching, I'm actually looking more towards the RDBMs console client behavior. postgres and mysql don't assume batching or transactions by default and buffer until the semicolon. Javascript consoles can't match that behavior perfectly since semicolons are (semi)optional in javascript, but I think its the right model for a javascript console for a RDBMS. If you still want JavaScript console precedent let me know and I'll look for it. |
| Comment by Tony Hannan [ 30/Nov/10 ] |
|
Why do you expect this buffering behavior? Do other javascript command-line interfaces do this? Can you give some pointers? |