[erlang-questions] os:cmd string parsing bug on Windows's erl
Erik Søe Sørensen
Fri Jun 27 11:54:01 CEST 2014
While on the topic, could we please have an "cmd()" which takes a program
name and a list of parameters, instead of just a string?
That would be less prone to both whitespace errors and injection issues.
Using os:cmd() with anything but a fixed string always gives me an uneasy
15> Echo = fun(Text) -> os:cmd("echo "++Text) end.
17> Echo("; date").
"\nfre jun 27 11:51:07 CEST 2014\n"
(On the other hand, I'm glad that open_port() *does* support the program
name + argument list mode.)
2014-06-27 10:29 GMT+02:00 Lukas Larsson <lukas@REDACTED>:
> On Fri, Jun 27, 2014 at 3:39 AM, KukHyun Lee <kukhyun@REDACTED> wrote:
>> erl on Windows7, os:cmd doesn't parse 'white-space'.
>> Eshell V6.0 (abort with ^G)
>> 1> os:cmd("c:/Program Files/test.exe").
>> 'c:/Program' is not recognized as an internal or external command,
>> operable program or batch file.
> Thanks for reporting this bug! I believe that I have fixed it already.
> Unfortunately the fix introduces a backwards incompatibility so it will not
> be released until OTP 18. The fix is already merged into the master branch
> at github.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions