Commit 8a3861c8 authored by Efthymia Bika's avatar Efthymia Bika Committed by Giorgos Korfiatis

Use execFile for Cygwin calls

parent 86f4307e
......@@ -17,7 +17,7 @@ var fs = require('fs');
var path = require('path');
var mkdirp = require("mkdirp");
var exec = require('child_process').exec;
var execSync = require('child_process').execSync;
var execFileSync = require('child_process').execFileSync;
var execFile = require('child_process').execFile;
var BAAS_HOME_DIR = '.baas';
......@@ -65,8 +65,8 @@ var templates_data = {
function get_unix_path(target) {
if(process.platform == 'win32') {
var out = execSync(CYGWIN_BASH +
" -c \"/usr/bin/cygpath '" + exec_path + "' \"");
var args = ["-c", "/usr/bin/cygpath " + escape_quote_str(exec_path)];
var out = execFileSync(CYGWIN_BASH, args);
var win_value = String(out).replace(/(\r\n|\n|\r)/gm, "");
return win_value + "/" + target;
}
......
......@@ -247,7 +247,8 @@ function run_duplicity(restore, force) {
if(process.platform == 'win32') {
directory = directory.replace(/\\/g, "\\\\");
exec(CYGWIN_BASH + " -c \"/usr/bin/cygpath '" + directory + "' \"",
var args = ["-c", "/usr/bin/cygpath " + escape_quote_str(directory)];
execFile(CYGWIN_BASH, args,
function(error, stdout, stderr) {
directory = String(stdout).replace(/(\r\n|\n|\r)/gm, "");
toggle_error(error, stderr);
......@@ -260,7 +261,8 @@ function run_duplicity(restore, force) {
var dup_cmd = DUPLICITY_PATH + " " + type_arg + force_arg + exclude_device_files_arg
+ include_arg + exclude_arg + file_arg + time_arg + dirs + ";";
exec(CYGWIN_BASH + " -c '" + cmd + dup_cmd + "'", dup_output);
var args = ["-c", cmd + dup_cmd];
execFile(CYGWIN_BASH, args, dup_output);
});
} else {
set_envs();
......@@ -292,7 +294,8 @@ function load_status() {
var dup_cmd = DUPLICITY_PATH + " collection-status swift://" + container;
if(process.platform == 'win32') {
var cmd = build_win_commands();
exec(CYGWIN_BASH + " -c '" + cmd + dup_cmd + "'", puts);
var args = ["-c", cmd + dup_cmd];
execFile(CYGWIN_BASH, args, puts);
} else {
set_envs();
exec(dup_cmd, {maxBuffer: 1000*1024} , puts);
......@@ -336,7 +339,8 @@ function remove_all(time, force) {
time + force_arg + " swift://" + container;
if(process.platform == 'win32') {
var cmd = build_win_commands();
exec(CYGWIN_BASH + " -c '" + cmd + dup_cmd + "'", puts);
var args = ["-c", cmd + dup_cmd];
execFile(CYGWIN_BASH, args, puts);
} else {
set_envs();
exec(dup_cmd, {maxBuffer: 1000*1024} , puts);
......
......@@ -151,8 +151,8 @@ function get_contents_by_date(value) {
container + " get " + value + " '" + time_path + "'"
if(process.platform == 'win32') {
var cmd = build_win_commands();
exec(CYGWIN_BASH + " -c '" + cmd + time_cmd + "'",
show_contents_by_date);
var args = ["-c", cmd + time_cmd];
execFile(CYGWIN_BASH, args, show_contents_by_date);
} else {
exec(time_cmd, show_contents_by_date);
}
......@@ -186,7 +186,8 @@ function load_timeview() {
var dup_cmd = DUPLICITY_PATH + " collection-status swift://" + container;
if(process.platform == 'win32') {
var cmd = build_win_commands();
exec(CYGWIN_BASH + " -c '" + cmd + dup_cmd + "'", puts);
var args = ["-c", cmd + dup_cmd];
execFile(CYGWIN_BASH, args, puts);
} else {
set_envs();
exec(dup_cmd, {maxBuffer: 1000*1024} , puts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment