diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 0679bb46f..709ce6ef8 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -394,6 +394,11 @@ class Application extends BaseApplication return $result; } catch (ScriptExecutionException $e) { + if ($this->getDisablePluginsByDefault() && $this->isRunningAsRoot() && !$this->io->isInteractive()) { + $io->writeError('Plugins have been disabled automatically as you are running as root, this may be the cause of the script failure.', true, IOInterface::QUIET); + $io->writeError('See also https://getcomposer.org/root', true, IOInterface::QUIET); + } + return $e->getCode(); } catch (\Throwable $e) { $ghe = new GithubActionError($this->io);