Skip to content

Commit 03fc839

Browse files
committed
Going to 0.0.4 - Fixing #35, #40 - Adding error return and removing exec-php
1 parent 4af5080 commit 03fc839

39 files changed

+10
-1796
lines changed

CREDITS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ getting this application to work.
88
germanocorrea
99

1010
[NPM]
11-
exec-php https://www.npmjs.com/package/exec-php
1211
configstore https://www.npmjs.com/package/configstore
1312
i18n-node https://www.npmjs.com/package/i18n-node
1413

js/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
'use strict';
22

33
// Imports
4-
var execPhp = require("exec-php");
54
var fs = require("fs");
65
var remote = require('electron').remote;
76
var Path = require("path")
87
const shell = require("electron").shell;
98
const dialog = remote.dialog;
109

10+
// ######
11+
var runner = require("child_process");
12+
1113
// Output mode
1214
var mode = "raw";
1315

@@ -31,8 +33,7 @@ const settings_default = {
3133
var php_path = conf.get("php.path");
3234
var editor = ace.edit("editor");
3335
editor.$blockScrolling = Infinity;
34-
// Prevents ACE bindings
35-
editor.keyBinding.setDefaultHandler(null);
36+
editor.commands.removeCommand("showSettingsMenu"); // Prevents ACE bindings at Cmd + ,
3637

3738
// PHP-exec cache bypass (temporary workaround)
3839
var count = 0;
@@ -124,15 +125,15 @@ function runCode() {
124125
var tmp_file = Path.join(__dirname, "tmp", "tmpcode"+(count++));
125126
fs.writeFileSync(tmp_file, code);
126127

127-
execPhp(tmp_file, php_path, function(err, php, out)
128-
{
128+
runner.exec(php_path + " -d'error_reporting=E_ALL' -d'display_errors=On' '" + tmp_file + "'", function(err, phpResponse, stderr) {
129129
fs.unlink(tmp_file);
130130
if (err) {
131131
setBusy(false);
132-
setOutput("Debug: " + err);
133-
return dialog.showErrorBox(i18n.__("Error"), i18n.__("An error has occurred."));
132+
// User doesn't need to know where the file is
133+
setOutput(phpResponse.replace(' in ' + tmp_file, ''));
134+
return false;
134135
}
135-
setOutput(out);
136+
setOutput(phpResponse);
136137
setBusy(false);
137138
});
138139
}

node_modules/exec-php/.npmignore

Lines changed: 0 additions & 29 deletions
This file was deleted.

node_modules/exec-php/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

node_modules/exec-php/README.md

Lines changed: 0 additions & 99 deletions
This file was deleted.

node_modules/exec-php/index.js

Lines changed: 0 additions & 64 deletions
This file was deleted.

node_modules/exec-php/lib/cli.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

node_modules/exec-php/lib/php/cli.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)