Erlang ports and Perl

borys borys@REDACTED
Wed Feb 23 18:56:58 CET 2000


> #!/usr/local/bin/perl
> while(1) {
> $cmd = <STDIN>;
> print STDERR "Received OK";
> print "ok";
> print STDERR "Sent";
> }

> The result of this is that perl receives the hello message and prints
> "Received OK" and "Sent" on stderr, but my erlang process never receives
> "ok". Tracing confirms that the hello message is sent to the port but
> nothing is received. Using an equivalent C program as the port program with
> the same erlang code works fine.


Try turning line buffering off by either setting $| to 1 or by
STDIN->autoflush(1).  I imagine libc is waiting for a newline before it
*really* sends the data.


> Sean
Trannie



More information about the erlang-questions mailing list