From 080cf610646ace3eb12881c1d09c1de52de89656 Mon Sep 17 00:00:00 2001 From: Thomas Bley Date: Thu, 14 Jan 2021 22:33:49 +0100 Subject: [PATCH] fix #5010 function exec() is disabled (#5012) * fix #5010 function exec() is disabled * Improve error message Co-authored-by: Thomas Bley Co-authored-by: Matthew Brown --- .../Internal/ExecutionEnvironment/SystemCommandExecutor.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Psalm/Internal/ExecutionEnvironment/SystemCommandExecutor.php b/src/Psalm/Internal/ExecutionEnvironment/SystemCommandExecutor.php index 0354900dd20..a78e3078d73 100644 --- a/src/Psalm/Internal/ExecutionEnvironment/SystemCommandExecutor.php +++ b/src/Psalm/Internal/ExecutionEnvironment/SystemCommandExecutor.php @@ -22,6 +22,10 @@ final class SystemCommandExecutor */ public function execute(string $command) : array { + if (!\function_exists('exec')) { + throw new \RuntimeException(sprintf('exec does not exist, failed to execute command: %s', $command)); + }; + exec($command, $result, $returnValue); if ($returnValue === 0) {