python-cmd2/fix_editor_stderr.patch

24 lines
998 B
Diff

# HG changeset patch
# User desaintmartin <cedric@desaintmartin.fr>
# Date 1369996392 0
# Branch desaintmartin/fixed-which-calls-being-verbose-to-stder-1369996337663
# Node ID 6743615a4a69908de97714e6673f14bfb96d3e6c
# Parent a1818298610cb601c6ed5691531cd224ed59e6b5
Fixed "which" calls being verbose to stderr.
Add "vi" to the list of possible editors.
diff --git a/cmd2.py b/cmd2.py
--- a/cmd2.py
+++ b/cmd2.py
@@ -420,8 +420,8 @@
if sys.platform[:3] == 'win':
editor = 'notepad'
else:
- for editor in ['gedit', 'kate', 'vim', 'emacs', 'nano', 'pico']:
- if subprocess.Popen(['which', editor], stdout=subprocess.PIPE).communicate()[0]:
+ for editor in ['gedit', 'kate', 'vim', 'vi', 'emacs', 'nano', 'pico']:
+ if subprocess.Popen(['which', editor], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]:
break
colorcodes = {'bold':{True:'\x1b[1m',False:'\x1b[22m'},