diff options
author | andi <andi@splitbrain.org> | 2005-06-11 14:10:59 +0200 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-06-11 14:10:59 +0200 |
commit | a08eb37aafd19cb62b1d58d188547fb14b27fbb8 (patch) | |
tree | 9f26ff6ad70b85cae5c020fc7a384dec513a59fd /inc/aspell.php | |
parent | ea2eed85b6afedcf37443a4953bade0186b9aef2 (diff) | |
download | rpg-a08eb37aafd19cb62b1d58d188547fb14b27fbb8.tar.gz rpg-a08eb37aafd19cb62b1d58d188547fb14b27fbb8.tar.bz2 |
spellchecker: compensate for aspell error and blocking problems
Sometimes Aspell seems to output not enough blank lines to signal
a line change. This patch tries to compensate for this by trying
the next two lines as well.
This patch also fixes a problem were reading from aspell could
produce a deadlock on the socket and would cause the spellchecker
to never return
darcs-hash:20050611121059-9977f-c772aa52ea0e73e7b7e5537afda047fa44a22395.gz
Diffstat (limited to 'inc/aspell.php')
-rw-r--r-- | inc/aspell.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/inc/aspell.php b/inc/aspell.php index 8267fb839..c0dc429bd 100644 --- a/inc/aspell.php +++ b/inc/aspell.php @@ -178,11 +178,14 @@ class Aspell{ foreach($data as $line){ fwrite($pipes[0],"^$line\n"); // aspell uses ^ to escape the line fflush($pipes[0]); + $line = ''; do{ - $r = fgets($pipes[1],8192); - $out .= $r; + $r = fread($pipes[1],1); + $line .= $r; if(feof($pipes[1])) break; - }while($r != "\n"); + if($r == "\n") break; + }while($line != "\n"); + $out .= $line; } fclose($pipes[0]); |