Use shell_exec in exec_edit

This commit is contained in:
Joshua Ramon Enslin 2020-12-05 20:48:51 +01:00
parent 6db2b4cc1f
commit 6a7f91ef1d
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -412,7 +412,7 @@ final class MD_STD {
* *
* @return void * @return void
*/ */
public static function ensure_file(string $filepath, array $accepted_mimetype = []) { public static function ensure_file(string $filepath, array $accepted_mimetype = []):void {
if (!\file_exists($filepath)) { if (!\file_exists($filepath)) {
throw new MDFileDoesNotExist("File " . basename($filepath) . " does not exist"); throw new MDFileDoesNotExist("File " . basename($filepath) . " does not exist");
@ -441,9 +441,9 @@ final class MD_STD {
*/ */
public static function exec_edit(string $cmds):void { public static function exec_edit(string $cmds):void {
$error = \exec($cmds . ' 2>&1'); $error = \shell_exec($cmds . ' 2>&1');
if (!empty($error)) { if (!empty($error)) {
throw new \Exception('Shell error: ' . $error); throw new \Exception('Shell error: ' . $error . PHP_EOL . PHP_EOL . 'Command was: ' . $cmds);
} }
} }