<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello Dave,<br>
Could you submit your patch this way:
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a href="https://github.com/erlang/otp/wiki/submitting-patches">https://github.com/erlang/otp/wiki/submitting-patches</a>
and scroll down to "Sending the patch"<br>
Thanks!<br>
<br>
BR Fredrik Gustafsson<br>
Erlang OTP Team<br>
On 12/18/2012 12:14 PM, Dave Cottlehuber wrote:
<blockquote
cite="mid:CAL+Y1nutAhdinxBTLNqFpS5RGHh5yH3mUP+7gZXgK_g7ZVbdjg@mail.gmail.com"
type="cite">
<pre wrap="">Bumping, is there anything you'd like differently so this could go
into R16 please?
Gist has been updated according to the thread,
<a class="moz-txt-link-freetext" href="https://gist.github.com/4189389ecd2bf1ca8163">https://gist.github.com/4189389ecd2bf1ca8163</a> I am not confident I have
the whitespacing right, the escript.c style seems to vary a lot.
We are very close to escript perfection on Windows!
A+
Dave
On 27 November 2012 14:40, Dave Cottlehuber <a class="moz-txt-link-rfc2396E" href="mailto:dch@jsonified.com"><dch@jsonified.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Windows, the vmargs are not passed through from the 2nd or 3rd
line of the escript file if the shebang syntax is not the unix shell
style. Which it often isn't, as you'd expect.
On unix, this produces the expected output of init-debug before requesting beer:
## ./icanhaz
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -init_debug -smp enable
main(_) -> io:format("I CAN HAZ BEER?~n", []).
On Windows, only the BEER is requested:
## icanhaz.cmd
@echo off & setlocal & path=%~dp0;%path%; & escript.exe
"%~dpn0.cmd" %* & goto :eof
%% -*- erlang -*-
%%! -init_debug -smp enable
main(_) -> io:format("I CAN HAZ BEER?~n", []).
NB: the somewhat cryptic sequence above tells a windows .cmd script to
suppress printing the batch file commands as they are processed, so
this @ would be a very common approach on windows. The path juggling
inside allows you distribute an escript with a NIF-based DLL alongside
in the same directory and have it "just work" without altering the
system or shell path.
Here's a small patch, accepting that the @ format is common on windows
<a class="moz-txt-link-freetext" href="https://gist.github.com/4189389ecd2bf1ca8163">https://gist.github.com/4189389ecd2bf1ca8163</a>
diff --git i/erts/etc/common/escript.c w/erts/etc/common/escript.c
index 9e80ec6..dcb1c85 100644
--- i/erts/etc/common/escript.c
+++ w/erts/etc/common/escript.c
@@ -264,7 +264,8 @@ append_shebang_args(char* scriptname)
static char linebuf[LINEBUFSZ];
char* ptr = fgets(linebuf, LINEBUFSZ, fd);
- if (ptr != NULL && linebuf[0] == '#' && linebuf[1] == '!') {
+ /* Acceptable Shebang syntax is #/ for unix or @ for windows */
+ if (ptr != NULL && ((linebuf[0] == '#' && linebuf[1] == '!') ||
linebuf[0] == '@')) {
/* Try to find args on second or third line */
ptr = fgets(linebuf, LINEBUFSZ, fd);
if (ptr != NULL && linebuf[0] == '%' && linebuf[1] == '%' &&
linebuf[2] == '!') {
NBB: the whitespace in escript.c is inconsistent. The patch reflects this.
NBBB: This yak was brought to you fully shaved whilst trying to
understand why `-detached` wasn't working in escript on Windows.
A+
Dave
</pre>
</blockquote>
<pre wrap="">_______________________________________________
erlang-patches mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-patches@erlang.org">erlang-patches@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-patches">http://erlang.org/mailman/listinfo/erlang-patches</a>
</pre>
</blockquote>
<br>
</body>
</html>