Closed
Bug 304451
Opened 19 years ago
Closed 19 years ago
RHINO shell runCommand passes closing quote of argument to command
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: michael.giroux, Assigned: igor)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
See example below -- from the output generated by the cmd.exe you can see that
the javascript shell runCommand passed the closing quote of the second argument
on to cmd.exe as part of the argument. The quote should have been removed.
js> runCommand("cmd.exe", "/c echo hello")
hello"
This causes some commands to fail. See example below:
Rhino 1.6 release 1 2004 11 30
js> runCommand("cmd.exe", "/c dir /on")
Parameter format not correct - """.
1
js>
In the example above, the effective command was: dir /on"
This caused cmd.exe to issue the parameter format error.
Reproducible: Always
Steps to Reproduce:
1. java -jar js.jar
2. js> runCommand("cmd.exe", "/c echo hello")
The output that is echoed to console will include the closing quote following hello.
Actual Results:
Results vary depending on what te executable does with the invalid argument.
Expected Results:
The closing quote on the argument string should be removed before invoking the
desired command.
Hello.
An appropriate argument list of "cmd" is as follows.
# Maybe, even windows is similar though it is OS/2.
runCommand('cmd', '/c', 'echo hello')
runCommand('cmd', '/c', 'dir /on')
var opt = { args: ['BOOKSHELF', 'HELP'], output: '' }
runCommand('cmd', '/c', 'env.cmd', opt)
Reporter | ||
Comment 2•19 years ago
|
||
Thanks, I see what i've done wrong.
Perhaps in a future update. the javadocs for runCommand could be updated to make
it more obvious to those of us who might overlook the subtle difference in the
syntax. Perhaps include the example that is shown in this message.
Michael
Assignee | ||
Comment 3•19 years ago
|
||
I added examples with runCommand usage on Windows to Rhino docs, see
http://lxr.mozilla.org/mozilla/source/js/rhino/docs/shell.html .
Assignee | ||
Updated•19 years ago
|
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•