From d00d7eef7f1da1fb4611d724c94357d31a990fec Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 7 Oct 2012 15:48:50 +0200 Subject: [PATCH] Use default editors if EDITOR is not set, improve windows compatibility --- src/Composer/Command/ConfigCommand.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index e0cd2c1fd..8be480f4f 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -115,9 +115,13 @@ EOT { // Open file in editor if ($input->getOption('editor')) { - // @todo Find a way to use another editor - $editor = system("bash -cl 'echo \$EDITOR'"); - system($editor . ' ' . $this->configFile->getPath() . ' > `tty`'); + $editor = getenv('EDITOR'); + if (!$editor) { + $editor = defined('PHP_WINDOWS_VERSION_BUILD') ? 'notepad' : 'vi'; + } + + system($editor . ' ' . $this->configFile->getPath() . (defined('PHP_WINDOWS_VERSION_BUILD') ? '': ' > `tty`')); + return 0; }