diff options
author | Christian A. Weber | 2021-03-28 19:45:44 +0200 |
---|---|---|
committer | Christian A. Weber | 2021-03-28 19:45:44 +0200 |
commit | 72b1b2091eb784b3f24dc415d44e865a455948c8 (patch) | |
tree | dcb683b240214b785ecef01d072a1056dc42071e /it.class | |
parent | ac64ca1b5bd9e888b9af43bddaf8e2d8a4dd8dd7 (diff) | |
download | itools-72b1b2091eb784b3f24dc415d44e865a455948c8.tar.gz itools-72b1b2091eb784b3f24dc415d44e865a455948c8.tar.bz2 itools-72b1b2091eb784b3f24dc415d44e865a455948c8.zip |
it::cdist() does nothing if no filenames are given, it::error() if filename=false
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -753,6 +753,14 @@ static function cdist(...$args) $files = array_merge((array)$files, (array)$arg); } + # no files: return early, don't execute cdist -q '' + if (!is_array($files) || !count($files)) + return true; + + # Check for invalid file names + if (in_array(false, $files, true) || in_array(null, $files, true)) + return it::error("invalid file name(s)"); + return ($errs = it::exec('cdist -q {-opts} {files} 2>&1', ['-opts' => $opts, 'files' => $files])) ? it::error(['title' => $errs]) : true; } |