escript os:cmd behavior different from erl or command line

Nicholas Frechette <>
Sat Jul 3 17:58:26 CEST 2010

I am attempting to run 'make' using os:cmd("make"). from an escript.
The command works fine if I run it from the erl interpreter (or from the
command like) but not from an escript.
>From the escript, (i'm building mochiweb) for each beam, i'll get an error
however the beam still gets created and in fact, using make -k seems to
force it to work.
Errors are like this:

:~/projects/mochiweb-dev$ ./test
(cd src;make all)
make[1]: Entering directory `/home/nicholas/projects/mochiweb-dev/src'
erlc -W -I ../include  +debug_info -o ../ebin mochifmt_records.erl
File has no extension: /home/nicholas/projects/mochiweb-dev/src/!
make[1]: *** [../ebin/mochifmt_records.beam] Error 1
make[1]: Leaving directory `/home/nicholas/projects/mochiweb-dev/src'
make: *** [all] Error 2

Where test is an escript like so:
#!/usr/bin/env escript
%% -*- erlang -*-

main(_Args) ->
    Result = os:cmd("make"),
    io:format("~s~n", [Result]),

I'm not a make fan/expert but as far as I can tell, the mochiweb make files
are looking good.
I'm using erlang R13B01 on ubuntu 9.10 and mochiweb is the head I grabbed
earlier today via the download source button.


More information about the erlang-questions mailing list