[erlang-questions] how to open_port with spaces in path?

Denis Bilenko denis.bilenko@REDACTED
Sun Feb 11 19:26:11 CET 2007


Hello,
I'm trying to execute external program which happened to have spaces in
path (not uncommon on windows). open_port exits with einval:

56> open_port({spawn, "D:/a a/my.exe"}, []).

=ERROR REPORT==== 11-Feb-2007::23:59:35 ===
Error in process <0.102.0> with exit value:
{einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},{erl_eval
,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}

** exited: {einval,[{erlang,open_port,[{spawn,"D:/a a/my.exe"},[]]},
                    {erl_eval,do_apply,5},
                    {shell,exprs,6},
                    {shell,eval_loop,3}]} **

I've tried to use quotes

57> open_port({spawn, "\"D:/a a/my.exe\""}, []).

it doesn't change anything.

Googling revealed this:
Known problems
  * os:cmd on WIN32 does not always catch the output from the executed program
    correctly. There is also a problem with executing programs with
space in the path.
http://www.erlang.org/doc/doc-4.8.2/erts-4.8.2/notes_history.html

It was not fixed? Are there any workarounds?

erl: 5.5.3
os: winxp

/Denis.



More information about the erlang-questions mailing list