Skip to content

Commit b369322

Browse files
committed
cleared bug in Cpp module
1 parent f59dddb commit b369322

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

cppModule.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ exports.compileCPP = function ( envData , code , fn ) {
2323
{
2424
console.log('INFO: '.green + filename +'.cpp created');
2525
//compiling and exrcuiting source code
26-
if(envData.OS === 'windows' || envData.cmd === 'g++')
26+
if(envData.cmd === 'g++')
2727
{
2828

2929
//compile c code
@@ -77,7 +77,7 @@ exports.compileCPP = function ( envData , code , fn ) {
7777

7878

7979
}
80-
else
80+
else if(envData.cmd === 'gcc')
8181
{
8282
//compile c code
8383
commmand = 'gcc ' + path + filename +'.cpp -o '+ path + filename+'.out' ;
@@ -124,7 +124,11 @@ exports.compileCPP = function ( envData , code , fn ) {
124124

125125
}
126126
});
127-
}
127+
}
128+
else
129+
{
130+
console.log('ERROR: '.red + 'choose either g++ or gcc ');
131+
}
128132
} //end of else part of err
129133
} //end of expors.stats
130134
}); //end of write file
@@ -145,7 +149,7 @@ exports.compileCPPWithInput = function ( envData , code , input , fn ) {
145149
else
146150
{
147151
console.log('INFO: '.green + filename +'.cpp created');
148-
if(envData.OS === 'windows' || envData.cmd ==='g++')
152+
if(envData.cmd ==='g++')
149153
{
150154

151155
//compile c code
@@ -222,7 +226,7 @@ exports.compileCPPWithInput = function ( envData , code , input , fn ) {
222226
});
223227

224228
}
225-
else
229+
else if ( envData.cmd == 'gcc')
226230
{
227231
//compile c code
228232
commmand = 'gcc ' + path + filename +'.cpp -o '+ path + filename+'.out' ;
@@ -293,6 +297,10 @@ exports.compileCPPWithInput = function ( envData , code , input , fn ) {
293297
}
294298
}
295299
});
300+
}
301+
else
302+
{
303+
console.log('ERROR: '.red + 'choose either g++ or gcc ');
296304
}
297305
} //end of else err
298306
} //end of exports.stats

node_modules/colors/package.json

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "compilex",
3-
"version": "0.7.2",
3+
"version": "0.7.3",
44
"description": "compilex is a node.js library which is used to build online code editor/compiler websites and webservices.",
55
"main": "compilex.js",
66
"dependencies": {

0 commit comments

Comments
 (0)