From f744f3d9242118dae5fb9daa9acd44741b3825ca Mon Sep 17 00:00:00 2001 From: cmp167 Date: Fri, 28 Jul 2023 18:10:56 +1200 Subject: [PATCH] Split cmpShellEscArr and cmpShellEscStr --- cmpUtil.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cmpUtil.php b/cmpUtil.php index cd64e18..65bfbf3 100644 --- a/cmpUtil.php +++ b/cmpUtil.php @@ -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); }