Split cmpShellEscArr and cmpShellEscStr

This commit is contained in:
cmp167
2023-07-28 18:10:56 +12:00
parent 778ad3817e
commit f744f3d924

View File

@@ -250,8 +250,7 @@
}
function cmpSysExec($cmaRaw, $opt = []) {
function cmpShellEscArr($cmaRaw) {
$ttr = array(
"\t" => "\\\t", "\$" => "\\\$",
"\\" => "\\\\", "\"" => "\\\"",
@@ -277,7 +276,18 @@
$cmaEsc[] = strtr($cmaRaw[$i], $ttr);
}
$cmdStr = join(" ", $cmaEsc);
return $cmaEsc;
}
function cmpShellEscStr($cmaRaw) {
$cmaEsc = $this->cmpShellEscArr($cmaRaw);
return join(" ", $cmaEsc);
}
function cmpSysExec($cmaRaw, $opt = []) {
$cmdStr = $this->cmpShellEscStr($cmaRaw);
if(!@$opt["silent"]) {
$this->d("cmpSysExec: " . $cmdStr);
}