Author christian.heimes
Recipients asvetlov, chris.jerdonek, christian.heimes, ezio.melotti, gregory.p.smith, lyapun, neologix, pitrou, r.david.murray, tim.golden
Date 2012-11-03.14:51:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1351954270.61.0.792882510567.issue16353@psf.upfronthosting.co.za>
In-reply-to
Content
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".
History
Date User Action Args
2012-11-03 14:51:10christian.heimessetrecipients: + christian.heimes, gregory.p.smith, pitrou, tim.golden, ezio.melotti, r.david.murray, asvetlov, chris.jerdonek, neologix, lyapun
2012-11-03 14:51:10christian.heimessetmessageid: <1351954270.61.0.792882510567.issue16353@psf.upfronthosting.co.za>
2012-11-03 14:51:10christian.heimeslinkissue16353 messages
2012-11-03 14:51:10christian.heimescreate