Message335959
PR 11931 experimented other tests:
return os.path.isfile(path) and os.access(path, os.X_OK)
and:
is_exe = False
with open(path, 'rb') as fp:
s = fp.read(2)
is_exe = s != b'MZ'
return os.path.isfile(path) and is_exe
I'm not sure that it's safe. Windows support a wide range of programs: .COM, .EXE, .VBS, .BAT, etc. It's hard to get a complete list. |
|
Date |
User |
Action |
Args |
2019-02-19 15:52:17 | vstinner | set | recipients:
+ vstinner, paul.moore, tim.golden, zach.ware, steve.dower, matrixise, mdk |
2019-02-19 15:52:17 | vstinner | set | messageid: <1550591537.65.0.703743627185.issue36021@roundup.psfhosted.org> |
2019-02-19 15:52:17 | vstinner | link | issue36021 messages |
2019-02-19 15:52:17 | vstinner | create | |
|