From 14a8629397ec70fc85472baca67c2a5d12d78257 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 3 Aug 2023 18:26:35 +0200 Subject: avoid name clashes with stats (mail3831); undercore also illustrates out of band --- it.class | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/it.class b/it.class index 858bbe4..4bffec5 100644 --- a/it.class +++ b/it.class @@ -678,7 +678,7 @@ static function filter_keys($array, $keys, $p = array()) * {-opts} array of opts => {value,true,false,null}: it::exec('ls {-opts}', ['-opts' => ["-l" => true]]); * @param $cmd Format string with {keywords} a la ET() * @param $args varargs, contains key => val arrays or positionals for filling in cmd line. val=null expands to nothing - * 'callback' optional closure, $fn($cmd) => print($cmd) for echo, => !print($cmd) for echo and suppress + * '_callback' optional closure, $fn($cmd) => print($cmd) for echo, => !print($cmd) for echo and suppress * @return output of command. shell errors not detectable, consider it::system or see /www/server/log/error_log */ static function exec($cmd, ...$args) @@ -687,7 +687,7 @@ static function exec($cmd, ...$args) $cmd = it::shell_command($cmd, $args); # NOPHPLINT $before = gettimeofday(true); - if ((!($args['callback'] instanceof Closure) || $args['callback']($cmd)) && !EDC('noexec')) + if ((!($args['_callback'] instanceof Closure) || $args['_callback']($cmd)) && !EDC('noexec')) $result = (string)shell_exec("set +o posix\n" . $cmd); @it::log('exec', round((gettimeofday(true) - $before)*1000) . "\t$cmd"); @@ -708,7 +708,7 @@ static function system($cmd, ...$args) $before = gettimeofday(true); $result = 0; - if ((!($args['callback'] instanceof Closure) || $args['callback']($cmd)) && !EDC('noexec')) + if ((!($args['_callback'] instanceof Closure) || $args['_callback']($cmd)) && !EDC('noexec')) system("set +o posix\n" . $cmd, $result); @it::log('exec', round((gettimeofday(true) - $before)*1000) . "\t$cmd"); -- cgit v1.2.3