浏览代码

Use default editors if EDITOR is not set, improve windows compatibility

Jordi Boggiano 12 年之前
父节点
当前提交
d00d7eef7f
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      src/Composer/Command/ConfigCommand.php

+ 7 - 3
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;
         }