On Windows, we can use NeedCurrentDirectoryForExePath to figure out if we should add the cwd to PATH when searching for executables if the mode is executable.
(cmd, mode)
| 1566 | |
| 1567 | |
| 1568 | def _win_path_needs_curdir(cmd, mode): |
| 1569 | """ |
| 1570 | On Windows, we can use NeedCurrentDirectoryForExePath to figure out |
| 1571 | if we should add the cwd to PATH when searching for executables if |
| 1572 | the mode is executable. |
| 1573 | """ |
| 1574 | return (not (mode & os.X_OK)) or _winapi.NeedCurrentDirectoryForExePath( |
| 1575 | os.fsdecode(cmd)) |
| 1576 | |
| 1577 | |
| 1578 | def which(cmd, mode=os.F_OK | os.X_OK, path=None): |
no outgoing calls
no test coverage detected
searching dependent graphs…