Skip to content

Commit

Permalink
Debug info improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Dec 15, 2020
1 parent 378a5b7 commit eb9616a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Composer/Command/RequireCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
);
} catch (\Exception $e) {
if ($this->newlyCreated) {
throw new \RuntimeException('No composer.json present in the current directory, this may be the cause of the following exception.', 0, $e);
throw new \RuntimeException('No composer.json present in the current directory ('.$this->file.'), this may be the cause of the following exception.', 0, $e);
}

throw $e;
Expand Down
2 changes: 1 addition & 1 deletion src/Composer/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function createComposer(IOInterface $io, $localConfig = null, $disablePlu
$config = static::createConfig($io, $cwd);
$config->merge($localConfig);
if (isset($composerFile)) {
$io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
$io->writeError('Loading config file ' . $composerFile .' ('.realpath($composerFile).')', true, IOInterface::DEBUG);
$config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));

$localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
Expand Down
7 changes: 6 additions & 1 deletion src/Composer/Json/JsonFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ public function read()
$json = $this->httpDownloader->get($this->path)->getBody();
} else {
if ($this->io && $this->io->isDebug()) {
$this->io->writeError('Reading ' . $this->path);
$realpathInfo = '';
$realpath = realpath($this->path);
if (false !== $realpath && $realpath !== $this->path) {
$realpathInfo = ' (' . $realpath . ')';
}
$this->io->writeError('Reading ' . $this->path . $realpathInfo);
}
$json = file_get_contents($this->path);
}
Expand Down

0 comments on commit eb9616a

Please sign in to comment.