summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlpha <ngcoder@live.com>2015-07-23 15:53:54 -0400
committerAlpha <ngcoder@live.com>2015-07-23 15:53:54 -0400
commit8c5cddb9712a24eab606e4ed7c5affcdc8dac5c6 (patch)
tree953366b215cb32e7a983f61cb56af1face62b1e7
parent82cd41b2a7f154a7ade5b01a62c30fb244ece4ac (diff)
parent6d8a60d0fb122b996c0291d466c80ff95fa5c104 (diff)
downloadwebgrind-8c5cddb9712a24eab606e4ed7c5affcdc8dac5c6.zip
webgrind-8c5cddb9712a24eab606e4ed7c5affcdc8dac5c6.tar.gz
webgrind-8c5cddb9712a24eab606e4ed7c5affcdc8dac5c6.tar.bz2
Merge pull request #59 from vlakoff/quotes
Add quotes around python and dot path if needed
-rw-r--r--index.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/index.php b/index.php
index d89dc85..1dff2d1 100644
--- a/index.php
+++ b/index.php
@@ -157,6 +157,13 @@ try {
$filename = Webgrind_Config::storageDir().$dataFile.'-'.$showFraction.Webgrind_Config::$preprocessedSuffix.'.'.Webgrind_Config::$graphImageType;
if (!file_exists($filename)) {
+ // Add enclosing quotes if needed
+ foreach (array('pythonExecutable', 'dotExecutable') as $exe) {
+ $item =& Webgrind_Config::$$exe;
+ if (strpos($item, ' ') !== false && !preg_match('/^".+"$/', $item)) {
+ $item = '"'.$item.'"';
+ }
+ }
shell_exec(Webgrind_Config::$pythonExecutable.' library/gprof2dot.py -n '.$showFraction.' -f callgrind '.Webgrind_Config::xdebugOutputDir().''.$dataFile.' | '.Webgrind_Config::$dotExecutable.' -T'.Webgrind_Config::$graphImageType.' -o ' . $filename);
}
readfile($filename);