11'use strict' ;
22
33// Imports
4- var execPhp = require ( "exec-php" ) ;
54var fs = require ( "fs" ) ;
65var remote = require ( 'electron' ) . remote ;
76var Path = require ( "path" )
87const shell = require ( "electron" ) . shell ;
98const dialog = remote . dialog ;
109
10+ // ######
11+ var runner = require ( "child_process" ) ;
12+
1113// Output mode
1214var mode = "raw" ;
1315
@@ -31,8 +33,7 @@ const settings_default = {
3133var php_path = conf . get ( "php.path" ) ;
3234var editor = ace . edit ( "editor" ) ;
3335editor . $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)
3839var 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}
0 commit comments