[issue20117] subprocess on Windows: wrong return code with shell=True

2019-04-26 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20117] subprocess on Windows: wrong return code with shell=True

2014-07-14 Thread eryksun

eryksun added the comment:

For what it's worth, an explicit exit will set the return code to the last 
error.

 subprocess.call(nonex  exit, shell=True, stderr=subprocess.DEVNULL)  

9009

--
nosy: +eryksun

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20117
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20117] subprocess on Windows: wrong return code with shell=True

2014-07-12 Thread Mark Lawrence

Mark Lawrence added the comment:

Can our Windows gurus advise on this please.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20117
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20117] subprocess on Windows: wrong return code with shell=True

2014-07-12 Thread Brian Curtin

Changes by Brian Curtin br...@python.org:


--
nosy:  -brian.curtin

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20117
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20117] subprocess on Windows: wrong return code with shell=True

2014-01-03 Thread Guido van Rossum

New submission from Guido van Rossum:

A little birdie told me:


Bug in Python subprocess doesn't allow to detect if
command executed through Windows system shell
exists.

If command doesn't exist, windows shell returns 9009
exit code (127 on Linux):
---[a.bat]---
@echo off
nonex
echo %ERRORLEVEL%

 a.bat
'nonex' is not recognized as an internal or external command,
operable program or batch file.
9009

However, when executed with Python, the return code
is different on Python 2.7/3.3:
---[x.py]---
import subprocess
p = subprocess.Popen(nonex, shell=True)
print(p.wait())

 python x.py
'nonex' is not recognized as an internal or external command,
operable program or batch file.
1

The same script executed on Linux gives correct result:
# python x.py
/bin/sh: non-existent: command not found
127

---[a.sh]---
nonex
echo $?


There's some more research at http://goo.gl/xEg2b1

Seems the culprit is cmd.exe, which is executed by Python internally.
It looks like it fails to return corresponding code 9009.

Possibly all that needs to be done is documenting this wart, if we can't do 
anything about it?

--
messages: 207251
nosy: ezio.melotti, gvanrossum
priority: low
severity: normal
stage: needs patch
status: open
title: subprocess on Windows: wrong return code with shell=True
type: behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20117
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20117] subprocess on Windows: wrong return code with shell=True

2014-01-03 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +brian.curtin, giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20117
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com