[asterisk-users] carefulwrite: write() returned error: Brokenpipe

Tilghman Lesher tlesher at digium.com
Thu Oct 22 11:43:22 CDT 2009


On Thursday 22 October 2009 11:09:00 Danny Nicholas wrote:
> I have some simple PERL scripts that worked fine with 1.4 SVN, but returned
> this error when I went to 1.4.26.2.  It seemed easier to change the ERROR
> to a NOTIFY than try to "Fix my bad code".
>
> Here is the "failing" code
> #!/usr/local/bin/perl
> use strict;
> use warnings;
>
> sub setvar {
>    my ($var, $val) = @_;
>    print STDOUT "SET VARIABLE $var \"$val\" \r\n";
>    my $rv=<STDIN>;
>    return;
>    }
>
> # turn off I/O buffering
> $| = 1;
>
> # get trunk information
> $SIG{'PIPE'} = 'IGNORE';
> my $images='TRUE';
> my $checks='TRUE';
> &setvar("TEST_RETURN", "OK");
> &setvar("CHECKS", $checks);
> &setvar("IMAGES", $images);
> exit;

What is clearly wrong with your script is that you're failing to retrieve all
of the setup information that is sent when the script first starts up.  Each
"response" that you're getting is actually setup information, and you exit
early, which is why the final response is not able to be sent.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list