[erlang-questions] erlang_port

Robert Raschke rtrlists@REDACTED
Mon Dec 19 12:25:07 CET 2011

On Mon, Dec 19, 2011 at 9:36 AM, eigenfunction <emeka_1978@REDACTED> wrote:

> I am trying to control a window os process with erlang. Can someone
> explain this to me:
> os:cmd("start www.yahoo.com") is working;
> erlang_port({spawn,"start www.yahoo.com"},[exit_status])  is not
> working and throws an exception error: enoent.
> Thx.
Try this:

erlang:open_port({spawn,"cmd /c start www.yahoo.com"},[exit_status]).

The "start" command is a windows command shell builtin, not an executable.
So you have to run it in a shell, which os:cmd/1 does automatically for
you, but erlang:open_port/2 doesn't. And enoent in this context means that
the exe named "start" could not be found.

Have fun,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111219/d2f019d9/attachment.htm>

More information about the erlang-questions mailing list