[erlang-questions] Can werl be detached?

zxq9 <>
Wed May 18 03:32:03 CEST 2016


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



More information about the erlang-questions mailing list