Use shell_exec in exec_edit

This commit is contained in:
jrenslin committed 2020-12-05 20:48:51 +01:00
1 parent 6db2b4cc1f
commit 6a7f91ef1d
1 file changed
+3 -3
+3 -3
View File
@@ -412,7 +412,7 @@ public static function mime_content_type(string $filepath):string {
*
* @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)) {
throw new MDFileDoesNotExist("File " . basename($filepath) . " does not exist");
@@ -441,9 +441,9 @@ public static function ensure_file(string $filepath, array $accepted_mimetype =
*/
public static function exec_edit(string $cmds):void {
$error = \exec($cmds . ' 2>&1');
$error = \shell_exec($cmds . ' 2>&1');
if (!empty($error)) {
throw new \Exception('Shell error: ' . $error);
throw new \Exception('Shell error: ' . $error . PHP_EOL . PHP_EOL . 'Command was: ' . $cmds);
}
}