Merge pull request #1837 from xonsh/which_returns

Fix which prints
This commit is contained in:
Anthony Scopatz 2016-10-13 08:43:10 -05:00 committed by GitHub
commit b36af6d943
2 changed files with 19 additions and 3 deletions

13
news/which_returns.rst Normal file
View file

@ -0,0 +1,13 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* Fixed the meassage printed when which is unable to find the command.
**Security:** None

View file

@ -97,7 +97,10 @@ def which(args, stdin=None, stdout=None, stderr=None, spec=None):
pargs = parser.parse_args(args)
verbose = pargs.verbose or pargs.all
captured = spec.captured in xproc.STDOUT_CAPTURE_KINDS
if spec is not None:
captured = spec.captured in xproc.STDOUT_CAPTURE_KINDS
else:
captured = False
if pargs.plain:
verbose = False
if xp.ON_WINDOWS:
@ -138,12 +141,12 @@ def which(args, stdin=None, stdout=None, stderr=None, spec=None):
print('{} not in '.format(', '.join(failures)),
file=stderr, end='')
if pargs.all:
print('globals or ')
print('globals or ', file=stderr, end='')
print('$PATH', file=stderr, end='')
if not pargs.skip:
print(' or xonsh.builtins.aliases',
file=stderr, end='')
print('', end='\n')
print('', file=stderr, end='\n')
return len(failures)