[erlang-questions] Can werl be detached?

John R. Ashmun <>
Mon May 30 23:49:16 CEST 2016


Now, running under R18.2 and Windows 10, I get a popup error message window
that says

"Werl

Failed to execute erl:  The system cannot find the file specified."

unless the current directory for the command prompt is "c:\Program
Files\erl7.3\erts-7.3\bin".

This is really similar to the restriction that Danial Goertzen pointed out
about R15 albeit with an error message about a different file that's in
...\erts-(Vsn)\bin.  Could werl be changed to look in the directory near
its own location rather than the current directory?  Further, it appears
that erl.exe and werl.exe are each duplicated between ..\erl7.3\bin and
..erl7.3\erts-7.3\bin, for what purpose I am unsure, yet if werl were able
to find itself, it could certainly find erl.exe.

When the current directory is set to ..\erts-7.3\bin and I enter

werl -detached -run wx demo

the demo runs admirably, but after I close its window, a Windows process
"erl" continues to run.  Doubtless this is the detached VM, but how do I
explain to naive game users its continuation and the need to stop it using,
e.g., Task Manager?

These startup questions have led me to the init module and its boot/1 and
stop/0 & stop/1 functions.  I think I would like my release's init process
to call stop( ) when my game stops.  Is there a handy example of the use of
init:stop( )?

Regards,
John Ashmun


On Wed, May 25, 2016 at 1:22 PM, Dan Gudmundsson <> wrote:

> Hmm,
> It works fine for me on Windows 10 from msys2 with erlang in the path
> and from cmd shell without erlang in the path:
>
> C:\Users\familjen>"c:\Program Files (x86)\erl7.3\bin\werl" -run wx demo
>
> C:\Users\familjen>"c:\Program Files (x86)\erl7.3\bin\werl" -detached -run
> wx demo
>
> Oh noticed the version you are running...
>
> It also works for me with 17.0 i.e. erl-6.0 which is the oldest I have
> installed here at home.
>
> Why are you using an old version of erlang?
> Can you try a newer version and see if that works?
>
>
> On Wed, May 25, 2016 at 9:49 PM John Ashmun <> wrote:
>
>> I just found time to try what you suggested with the wx demo, but I got
>> the same pop up Windows error message as when I try to run my release with
>> -detached.
>>
>> I added ...\erts-5.9\bin to %Path% and tried again but it failed again
>> with the same error message.
>>
>> Sent from my iPhone
>>
>> On May 18, 2016, at 12:02 AM, Dan Gudmundsson <> wrote:
>>
>> At least this works as it should:
>>
>> werl -detached -run wx demo
>>
>>
>> On Wed, May 18, 2016 at 3:48 AM John R. Ashmun <>
>> wrote:
>>
>>>
>>>
>>> On Tue, May 17, 2016 at 6:32 PM, zxq9 <> wrote:
>>>
>>>> On Tuesday 17 May 2016 16:47:35 John R. Ashmun wrote:
>>>> > Perhaps my subject is not quite the correct question.  Here's my
>>>> context:
>>>> >
>>>> > I'm beginning to recreate in Erlang on Microsoft Windows 10 a public
>>>> domain
>>>> > program I used to enjoy on my Commodore Amiga:  mATC was a game in
>>>> which
>>>> > the user acted as a military Air Traffic Controller.  I am using a wx
>>>> > window to draw the player's map with aircraft data blocks overlaid.  I
>>>> > don't have a use for the initial window that opens when werl is
>>>> started.
>>>>
>>>> Awesome!
>>>>
>>>> > If I use this Command Prompt batch file, mATC.bat:
>>>> >
>>>> > werl -pa ebin -pa mATC_app\ebin -detached -boot mATC -config sys
>>>> >
>>>> > a Windows error message window appears that says:
>>>> >
>>>> > "Failed to execute C:\Program Files\erl5.9\erts5.9\bin\beam.smp.dll
>>>> >  The system cannot find the file specified."
>>>> >
>>>> > The DLL is actually present at that location, and of course
>>>> everything runs
>>>> > well when I don't use -detached.
>>>>
>>>> Hrm... that seems odd, but I have to admit I have no experience running
>>>> actual releases on Windows. What I usually do instead is have the
>>>> runtime
>>>> installed on the Windows machine, unpack project code and kick things
>>>> off
>>>> with an escript that builds and then launches the code I want to run.
>>>>
>>>> Changing from releases to from-source build->run may require a bit of
>>>> shuffling -- and may or may not be worth it depending on the project.
>>>> But this has been very effective and lightweight for my purposes.
>>>>
>>>> Like everything else on Windows there are a few quirks to making
>>>> escripts
>>>> a click-to-run experience (specifying full path to "escript.exe" instead
>>>> of "escript" in your launcher, space for unheeded shebang, etc.). I've
>>>> wanted for a few years now to formalize and simplify a solution to
>>>> this...
>>>> but real life gets in the way of the things I wish I could do as
>>>> community
>>>> project work. :-(
>>>>
>>>> The escript-to-bootstrap approach has made my Erlang GUI experience on
>>>> Windows fairly painless -- I can develop on Linux or BSD and almost
>>>> always
>>>> get away with relying on anything that works there (to include wx)
>>>> working
>>>> pretty much the same way on Windows.
>>>>
>>>> I have not tried this on Windows 10 yet, but I assume it will continue
>>>> to
>>>> work the same way it does on Windows 7 and 8.1.
>>>>
>>>> -Craig
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> 
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>
>>> I will look into escript, thanks.
>>>
>>> John
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160530/d16dccab/attachment.html>


More information about the erlang-questions mailing list