@@ -94,14 +94,14 @@ const Cpp = {
94
94
args ( context ) {
95
95
const code = context . getCode ( )
96
96
const tmpFile = GrammarUtils . createTempFileWithCode ( code , ".cpp" )
97
+ const tempOutFile = GrammarUtils . createTempPath ( "cpp-" , ".out" )
97
98
let cmdArgs = ""
98
-
99
99
switch ( os ) {
100
100
case "darwin" :
101
- cmdArgs = `xcrun clang++ -std=c++14 ${ options } -fcolor-diagnostics -include iostream ${ tmpFile } -o /tmp/cpp.out && /tmp/cpp.out `
101
+ cmdArgs = `xcrun clang++ -std=c++14 ${ options } -fcolor-diagnostics -include iostream ${ tmpFile } -o ${ tempOutFile } && ${ tempOutFile } `
102
102
break
103
103
case "linux" :
104
- cmdArgs = `g++ ${ options } -std=c++14 -include iostream ${ tmpFile } -o /tmp/cpp.out && /tmp/cpp.out `
104
+ cmdArgs = `g++ ${ options } -std=c++14 -include iostream ${ tmpFile } -o ${ tempOutFile } && ${ tempOutFile } `
105
105
break
106
106
default : {
107
107
atom . notifications . addError ( `Not support on ${ os } ` )
@@ -114,13 +114,14 @@ const Cpp = {
114
114
"File Based" : {
115
115
command,
116
116
args ( { filepath } ) {
117
+ const tempOutFile = GrammarUtils . createTempPath ( "cpp-" , ".out" )
117
118
let cmdArgs = ""
118
119
switch ( os ) {
119
120
case "darwin" :
120
- cmdArgs = `xcrun clang++ -std=c++14 ${ options } -fcolor-diagnostics -include iostream '${ filepath } ' -o /tmp/cpp.out && /tmp/cpp.out `
121
+ cmdArgs = `xcrun clang++ -std=c++14 ${ options } -fcolor-diagnostics -include iostream '${ filepath } ' -o ${ tempOutFile } && ${ tempOutFile } `
121
122
break
122
123
case "linux" :
123
- cmdArgs = `g++ -std=c++14 ${ options } -include iostream '${ filepath } ' -o /tmp/cpp.out && /tmp/cpp.out `
124
+ cmdArgs = `g++ -std=c++14 ${ options } -include iostream '${ filepath } ' -o ${ tempOutFile } && ${ tempOutFile } `
124
125
break
125
126
case "win32" :
126
127
if (
@@ -131,7 +132,7 @@ const Cpp = {
131
132
filepath = path . posix
132
133
. join ( ...[ filepath . split ( path . win32 . sep ) [ 0 ] . toLowerCase ( ) , ...filepath . split ( path . win32 . sep ) . slice ( 1 ) ] )
133
134
. replace ( ":" , "" )
134
- cmdArgs = `g++ -std=c++14 ${ options } -include iostream /mnt/${ filepath } -o /tmp/cpp.out && /tmp/cpp.out `
135
+ cmdArgs = `g++ -std=c++14 ${ options } -include iostream /mnt/${ filepath } -o ${ tempOutFile } && ${ tempOutFile } `
135
136
}
136
137
break
137
138
default : {
0 commit comments