[issue16353] add function to os module for getting path to default shell
Christian Heimes
report at bugs.python.org
Sat Nov 3 15:51:10 CET 2012
Christian Heimes added the comment:
I'm with Chris. The information should be stored in the os module. I suggest os.shell var or os.get_shell() function like this:
def get_shell():
for path in confstr("CS_PATH").split(pathsep):
sh = sep.join((path, "sh"))
try:
mode = stat(sh).st_mode
except OSError:
pass
else:
if st.S_ISREG(mode):
return sh
raise FileNotFound("sh")
According to all examples S_ISREG() is sufficient here.
On Windows the function should use the env var COMSPEC instead of hard coding "cmd.exe".
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16353>
_______________________________________
More information about the Python-bugs-list
mailing list