In Perl, I use an Open2 call to a process which calls spamc, write data to it, and collect the result. Like so:
 
use FileHandle;
use IPC::Open2;
 
$pid = open2 (*READER, *WRITER, "/usr/local/sa/bin/spamc -f -d 127.0.0.1 -u test");
print WRITER $text;
close (WRITER);
$body .= $_ while (<READER>);
close (READER);
 
This works flawlessly on not all that large files; but when I tried it on a file over 1M, the whole process hangs at "print WRITER $text;". I know the docs talk about unix buffering and all, but I thought the output of spamc is supposed to be unbuffered?
 
Does anyone have any idea why it would hang altogether?
 
Thanks,
 
- Mark

Reply via email to