mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Fix subprocess.run on Windows Python 3.7 (#5220)
## Summary From the [subprocess docs](https://docs.python.org/3/library/subprocess.html#subprocess.Popen): > Changed in version 3.6: args parameter accepts a path-like object if shell is False and a sequence containing path-like objects on POSIX. > > Changed in version 3.8: args parameter accepts a path-like object if shell is False and a sequence containing bytes and path-like objects on Windows. We want to support python 3.7 on windows, so we need to convert the `Path` into a `str`
This commit is contained in:
parent
30734f06fd
commit
acb23dce3c
1 changed files with 3 additions and 1 deletions
|
@ -32,5 +32,7 @@ def find_ruff_bin() -> Path:
|
|||
|
||||
if __name__ == "__main__":
|
||||
ruff = find_ruff_bin()
|
||||
completed_process = subprocess.run([ruff, *sys.argv[1:]])
|
||||
# Passing a path-like to `subprocess.run()` on windows is only supported in 3.8+,
|
||||
# but we also support 3.7
|
||||
completed_process = subprocess.run([os.fsdecode(ruff), *sys.argv[1:]])
|
||||
sys.exit(completed_process.returncode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue