Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Driver error #3

Closed
mcandre opened this Issue Feb 26, 2011 · 6 comments

Comments

Projects
None yet
2 participants

mcandre commented Feb 26, 2011

I ran the example script.

$ ./helloworld.escript

If I omit either of the comments

#!/usr/bin/env escript
%%! -noinput -pa ../cecho/ebin +A 50

then an error message blots the screen:

=ERROR REPORT==== 26-Feb-2011::16:13:56 ===
driver_select(0x0000000000000244, 0, ERL_DRV_READ, 1) by cecho driver #Port<0.580> stealing control of fd=0 from input driver fd (0/1) #Port<0.441>

The "Hello World!" message appears, bouncing around and eventually erasing the error message.

But the error message appears on all of my cecho programs, getting in the way of my interfaces. Can you help me remove it?

Specs:

cecho 2010-08-31
Agner 0.4.14
Erlang R14B01
MacPorts 1.9.2
Mac OS X 10.6.6
MacBook Pro 5,1

Owner

mazenharake commented Feb 26, 2011

Hi mcandre,

Those two lines are not comments they are directives. They aren't optional. Any reason for why you would want to remove them?

Anyway for the error it seems that the erlang shell and cecho are competing for standard input so in your case the "-noinput" directive seems to be necessary.

mcandre commented Feb 27, 2011

To my text editor, they look like comments. Their omission proves that they are indeed directives. I would like to remove the shebang because it interferes with erl's ability to compile() code.

Owner

mazenharake commented Feb 27, 2011

Why do you want to compile it (since it is a script)? If it is a performance issue then you should still be able to have it compiled using the -mode(compile) directive (in the code not to erl).

Another consideration is to create a normal erlang file and use -eval(...) to run it, this is described in the README file.

Will this solve the problem?

mcandre commented Feb 27, 2011

For me, escript hates recursive calls. It often crashes, complaining that a function does not exist even when I export the function for the benefit of other modules. The only way I get my code to run with escript is to compile it first in erl.

Owner

mazenharake commented Feb 27, 2011

Try adding -mode(compile) which will probably solve the problem you are facing. this makes macros like ?MODULE work as well.

Check out http://www.erlang.org/doc/man/escript.html

Closing this then as it is not cecho specific anymore.

mcandre commented Feb 27, 2011

Thanks!

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment