small fix to help with mount detection on cifs volumes

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2021-06-15 16:50:42 -06:00
parent ad40b6a1ef
commit 9a4d69defe
1 changed files with 18 additions and 8 deletions

View File

@ -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;