File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,13 @@ temp.track()
11
11
const GrammarUtils = {
12
12
tempFilesDir : path . join ( os . tmpdir ( ) , "atom_script_tempfiles" ) ,
13
13
14
+ // Public: Create a temporary path
15
+ //
16
+ // Returns the {String} filepath of the new file
17
+ createTempPath ( prefix = "" , extension = "" ) {
18
+ return temp . path ( { dir : this . tempFilesDir , prefix, suffix : extension } )
19
+ } ,
20
+
14
21
// Public: Create a temporary file with the provided code
15
22
//
16
23
// * `code` A {String} containing some code
Original file line number Diff line number Diff line change @@ -11,13 +11,14 @@ const options = "-Wall -include stdio.h"
11
11
12
12
// TODO add windows support
13
13
function CArgs ( { filepath } ) {
14
+ const tempOutFile = GrammarUtils . createTempPath ( "c-" , ".out" )
14
15
let cmdArgs = ""
15
16
switch ( os ) {
16
17
case "darwin" :
17
- cmdArgs = `xcrun clang ${ options } -fcolor-diagnostics '${ filepath } ' -o /tmp/c.out && /tmp/c.out `
18
+ cmdArgs = `xcrun clang ${ options } -fcolor-diagnostics '${ filepath } ' -o ${ tempOutFile } && ${ tempOutFile } `
18
19
break
19
20
case "linux" :
20
- cmdArgs = `cc ${ options } '${ filepath } ' -o /tmp/c.out && /tmp/c.out `
21
+ cmdArgs = `cc ${ options } '${ filepath } ' -o ${ tempOutFile } && ${ tempOutFile } `
21
22
break
22
23
default : {
23
24
atom . notifications . addError ( `Not support on ${ os } ` )
You can’t perform that action at this time.
0 commit comments