Skip to content

Commit f22d6a0

Browse files
committed
correct quotes for shell variables and path
1 parent 27b1665 commit f22d6a0

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

electronClient.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,18 @@ ipcMain.on('script:copy', function(e, script){
5050
}
5151
console.log("The script file was saved to " + path.join(tmp_folder, "script.sh"));
5252
console.log("Running " + path.join(tmp_folder, "script.sh"));
53-
exec((isWin ? '':'bash ') + path.join(tmp_folder, "script.sh"), function (err, stdout, stderr) {
53+
if(isWin) {
54+
exec('' + path.join(tmp_folder, "script.sh"), function (err, stdout, stderr){
5455
//console.log(err, stdout, stderr);
5556
return;
56-
});
57+
});
58+
}
59+
else {
60+
exec('bash \"' + path.join(tmp_folder, "script.sh\""), function (err, stdout, stderr) {
61+
//console.log(err, stdout, stderr);
62+
return;
63+
});
64+
}
5765
});
5866

5967
});
@@ -66,7 +74,7 @@ ipcMain.on('script:execute', function(e){
6674
});
6775
}
6876
else {
69-
exec('bash -c "$NETKIT_HOME/lstart -d ' + path.join(tmp_folder, "lab") + '"', function (err, stdout, stderr) {
77+
exec('bash -c \'$NETKIT_HOME/lstart -d "\\\"' + path.join(tmp_folder, "lab") + '\\\""\'', function (err, stdout, stderr) {
7078
//console.log(err, stdout, stderr);
7179
return;
7280
});
@@ -82,7 +90,7 @@ ipcMain.on('script:clean', function(e){
8290
});
8391
}
8492
else {
85-
exec('bash -c "$NETKIT_HOME/lclean -d ' + path.join(tmp_folder, "lab") + '"', function (err, stdout, stderr) {
93+
exec('bash -c \'$NETKIT_HOME/lclean -d "\\\"' + path.join(tmp_folder, "lab") + '\\\""\'', function (err, stdout, stderr) {
8694
//console.log(err, stdout, stderr);
8795
return;
8896
});

js/make.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ function makeScript(lab){
474474
text += "echo '" + lines[lineIndex] + "' >> " + fileName + "\n";
475475
}
476476
}
477-
text += "rm $0\n";
477+
text += "rm \"$0\"\n";
478478

479479
return text;
480480
}

0 commit comments

Comments
 (0)