aboutsummaryrefslogtreecommitdiff
path: root/php/runtime.js
diff options
context:
space:
mode:
Diffstat (limited to 'php/runtime.js')
-rw-r--r--php/runtime.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/php/runtime.js b/php/runtime.js
index ce2629d..fc0c122 100644
--- a/php/runtime.js
+++ b/php/runtime.js
@@ -1,19 +1,30 @@
const child = require('child_process');
const util = require('util');
const chalk = require('chalk');
+const fs = require('fs');
const exec = util.promisify(child.exec);
module.exports = async ([file, id]) => {
startd = new Date();
try {
error = undefined;
- var { stdout, stderr } = await exec("php \"" + file.split("\"").join("\\\"") + "\"");
+ if (require('os').platform() === "win32") {
+ var { stdout, stderr } = await exec("runtime\\php.exe \"" + file.split("\"").join("\\\"") + "\"");
+ } else {
+ var { stdout, stderr } = await exec("php \"" + file.split("\"").join("\\\"") + "\"");
+ }
} catch (e) {
error = e;
}
stopd = new Date();
diff = stopd - startd;
+ if (fs.existsSync(file + ".ELECTRODECACHE~.php")) {
+ fs.unlinkSync(file + ".ELECTRODECACHE~.php");
+ }
+
+ require('../core/cacheClean')();
+
console.log(chalk.gray(cluster.worker.id + " ") + chalk.blueBright("php:") + " total run time: " + diff + "ms");
returnobj = {error: null, content: null, stderr: null, id: id};