src/Common.php
final public static function exec(string $cmd, array $args=[]) {
		foreach ($args as $key => $val)
			$args[$key] = escapeshellarg($val);
		$cmd = vsprintf($cmd, $args);
		exec($cmd, $output, $retcode);
		if ($retcode !== 0)
			return false;
		return $output;
	}
final public static function exec(string $cmd, array $args=[]) {
		foreach ($args as $key => $val)
			$args[$key] = escapeshellarg($val);
		$cmd = vsprintf($cmd, $args);
		exec($cmd, $output, $retcode);
		if ($retcode !== 0)
			return false;
		return $output;
	}
final public static function exec ( string $ cmd , array $ args = [ ] ) { foreach ( $ args as $ key => $ val ) $ args [ $ key ] = escapeshellarg ( $ val ) ; $ cmd = vsprintf ( $ cmd , $ args ) ; exec ( $ cmd , $ output , $ retcode ) ; if ( $ retcode !== 0 ) return false ; return $ output ; }
Execute arbitrary shell commands. Use with care.

@param string $cmd Command with '%s' as parameter placeholders.
@param array $args List of parameters to replace the
placeholders in command.
@return bool|array False on failure, stdout lines otherwise.
Execute arbitrary shell commands . Use with care .