small fix to help with mount detection on cifs volumes
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
ad40b6a1ef
commit
9a4d69defe
|
|
@ -5,7 +5,8 @@ FINDMNT_COMMON_OPTIONS = [
|
||||||
"--output",
|
"--output",
|
||||||
"source,target,fstype,label,options,avail,size,used",
|
"source,target,fstype,label,options,avail,size,used",
|
||||||
"-b",
|
"-b",
|
||||||
"-J"
|
"-J",
|
||||||
|
"--nofsroot", // prevents unwanted behavior with cifs volumes
|
||||||
];
|
];
|
||||||
|
|
||||||
class Mount {
|
class Mount {
|
||||||
|
|
@ -36,7 +37,7 @@ class Mount {
|
||||||
|
|
||||||
if (!options.executor) {
|
if (!options.executor) {
|
||||||
options.executor = {
|
options.executor = {
|
||||||
spawn: cp.spawn
|
spawn: cp.spawn,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -290,7 +291,16 @@ class Mount {
|
||||||
args.unshift(command);
|
args.unshift(command);
|
||||||
command = mount.options.paths.sudo;
|
command = mount.options.paths.sudo;
|
||||||
}
|
}
|
||||||
console.log("executing mount command: %s %s", command, args.join(" "));
|
// https://regex101.com/r/FHIbcw/3
|
||||||
|
// replace password=foo with password=redacted
|
||||||
|
// (?<=password=)(?:([\"'])(?:\\\1|.)*?\1|[^,\s]+)
|
||||||
|
const regex = /(?<=password=)(?:([\"'])(?:\\\1|.)*?\1|[^,\s]+)/gi;
|
||||||
|
const cleansedLog = `${command} ${args.join(" ")}`.replace(
|
||||||
|
regex,
|
||||||
|
"redacted"
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("executing mount command: %s", cleansedLog);
|
||||||
const child = mount.options.executor.spawn(command, args, options);
|
const child = mount.options.executor.spawn(command, args, options);
|
||||||
|
|
||||||
let didTimeout = false;
|
let didTimeout = false;
|
||||||
|
|
@ -302,15 +312,15 @@ class Mount {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
child.stdout.on("data", function(data) {
|
child.stdout.on("data", function (data) {
|
||||||
stdout = stdout + data;
|
stdout = stdout + data;
|
||||||
});
|
});
|
||||||
|
|
||||||
child.stderr.on("data", function(data) {
|
child.stderr.on("data", function (data) {
|
||||||
stderr = stderr + data;
|
stderr = stderr + data;
|
||||||
});
|
});
|
||||||
|
|
||||||
child.on("close", function(code) {
|
child.on("close", function (code) {
|
||||||
const result = { code, stdout, stderr };
|
const result = { code, stdout, stderr };
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue