From: x2003bruneau Date: Sun, 5 Mar 2006 22:25:08 +0000 (+0000) Subject: Evite que wrap retourne une chaîne vide si Autoformat n'est pas installé sur la... X-Git-Tag: 1.8~266 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=ee4709c7854519b87eb812880152eda78abd6fc3;p=banana.git Evite que wrap retourne une chaîne vide si Autoformat n'est pas installé sur la machine git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@29 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- diff --git a/banana/misc.inc.php b/banana/misc.inc.php index f8df870..8859e98 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -294,13 +294,16 @@ function wrap($text, $_prefix="") $text = join("\n-- \n", $parts); } else { $sign = ''; - $text = $text; } global $banana; $length = $banana->wrap; $cmd = "echo ".escapeshellarg($text)." | perl -MText::Autoformat -e 'autoformat {left=>1, right=>$length, all=>1 };'"; - exec($cmd, $result); + $ret = 0; + exec($cmd, $result, $ret); + if ($ret != 0) { + $result = split("\n", $text); + } return $_prefix.join("\n$_prefix", $result).($_prefix ? '' : $sign); }