summaryrefslogtreecommitdiffstats
path: root/application/libraries/Pygments.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-05-27 00:18:45 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-28 18:10:13 +0200
commit33321b43cafbb731bff062aeffd6f46e38749faf (patch)
tree201c2296022f015d686368537dde36ea7d7b1ab1 /application/libraries/Pygments.php
parentd00027bbba30a7693135c8b7cb5de267e8c478d4 (diff)
Improve running of external commands
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/libraries/Pygments.php')
-rw-r--r--application/libraries/Pygments.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/application/libraries/Pygments.php b/application/libraries/Pygments.php
index 588f78842..5d37b69c3 100644
--- a/application/libraries/Pygments.php
+++ b/application/libraries/Pygments.php
@@ -22,11 +22,14 @@ class Pygments {
private static function get_pygments_info() {
return cache_function_full('pygments_info-v2', 1800, function() {
- ob_start();
- passthru(escapeshellarg(FCPATH."scripts/get_lexer_list.py"));
- $output = ob_get_clean();
+ $r = (new \libraries\ProcRunner(array(FCPATH."scripts/get_lexer_list.py")))->execSafe();
- return json_decode($output, true);
+ $ret = json_decode($r["stdout"], true);
+ if ($ret === NULL) {
+ throw new \exceptions\ApiException('pygments/json-failed', "Failed to decode JSON", $r);
+ }
+
+ return $ret;
});
}