namespace MediaWiki\Shell;
+use MediaWiki\MediaWikiServices;
+
/**
* Executes shell commands
*
*
* ... = $result->getExitCode();
* ... = $result->getStdout();
+ * ... = $result->getStderr();
*/
class Shell {
/**
- * Returns a new instance of this class
+ * Returns a new instance of Command class
*
- * @param string|string[] $command If string, a properly shell-escaped command line,
- * or an array of unescaped arguments, in which case each value will be escaped
+ * @param string|string[] $command String or array of strings representing the command to
+ * be executed, each value will be escaped.
* Example: [ 'convert', '-font', 'font name' ] would produce "'convert' '-font' 'font name'"
* @return Command
*/
// treat it as a list of arguments
$args = reset( $args );
}
- $command = new Command();
+ $command = MediaWikiServices::getInstance()
+ ->getShellCommandFactory()
+ ->create();
+
return $command->params( $args );
}