diff options
author | Urban Müller | 2023-07-03 21:35:29 +0200 |
---|---|---|
committer | Urban Müller | 2023-07-03 21:35:29 +0200 |
commit | 36ffd806aec597c6e3eff966d47f02cb23f66a7b (patch) | |
tree | efa71ea158d1db918f02d7aad5178067561455be | |
parent | 85fc7f9d60f13bf00c322ceda40eed3f3e873e21 (diff) | |
download | itools-36ffd806aec597c6e3eff966d47f02cb23f66a7b.tar.gz itools-36ffd806aec597c6e3eff966d47f02cb23f66a7b.tar.bz2 itools-36ffd806aec597c6e3eff966d47f02cb23f66a7b.zip |
mark it::exec call safe, give better it::exec example
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | it_pipe.class | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -166,7 +166,7 @@ Functions: it::error($info) -- print or mail error message it::fatal($info) -- print or mail error message, then exit it::bail($message) -- print message to stderr, exit with errcode - it::exec($command, $values) -- execute command, return output + it::exec('command', $values) -- execute command, return output it::getopt($usage) -- parse (or print) usage, return options, it::gets() -- fetch next line from stdin or named arg it::imageconvert($params) -- Convert image using ImageMagick convert diff --git a/it_pipe.class b/it_pipe.class index ac1b987..73ce75a 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -19,7 +19,7 @@ function __construct($p = array()) if (array_key_exists('data', $p)) $this->lines = is_array($p['data']) || $p['data'] === null ? (array)$p['data'] : explode("\n", rtrim($p['data'], "\n")); else if (array_key_exists('cmd', $p)) - $this->lines = strlen($data = it::exec($p['cmd'], $p['args'])) ? explode("\n", rtrim($data, "\n")) : array(); + $this->lines = strlen($data = it::exec($p['cmd'], $p['args'])) ? explode("\n", rtrim($data, "\n")) : array(); # NOPHPLINT else foreach ((array)($p['fn'] ? $p['fn'] : "php://stdin") as $fn) $this->lines = array_merge((array)$this->lines, ($t = it::file($fn, FILE_IGNORE_NEW_LINES)) === false ? array() : $t); |