We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`format` session fail to run locally on Window platform
### Subject
When I ran `nox -rs format` to format the files,  the format process terminates due to `FileNotFoundError` reported at line 139 at file `noxfile.py`:

![image](https://user-images.githubusercontent.com/23013350/184066564-3a322445-c7b8-48ba-8ee9-4e747e964037.png)


### Environment
Window 10

### Steps to Reproduce
Just ran `nox -rs format` on Window machine.


I suspect the created `process` could not find the files properly, and my workaround is to using `session.run()` instead:
```python
@nox.session()
def format(session: nox.Session) -> None:
    """Run code formatters."""
    session.install("pre-commit")
    session.run("pre-commit", "--version")

    # process = subprocess.run(
    #     ["pre-commit", "run", "--all-files"],
    #     env=session.env,
    #     text=True,
    #     stdout=subprocess.PIPE,
    #     stderr=subprocess.STDOUT,
    # )
    # # Ensure that pre-commit itself ran successfully
    # assert process.returncode in (0, 1)

    session.run("pre-commit", "run", "--all-files") # my workaround

    lint(session)
```

Perhaps this failure is due to my improper environment setup for the repo. If so, please correct me.

Thanks.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `noxfile.py`
Content:
```
1 import os
2 import shutil
3 import subprocess
4 
5 import nox
6 
7 SOURCE_FILES = [
8     "docs/",
9     "dummyserver/",
10     "src/",
11     "test/",
12     "noxfile.py",
13     "setup.py",
14 ]
15 
16 
17 def tests_impl(
18     session: nox.Session,
19     extras: str = "socks,secure,brotli,zstd",
20     byte_string_comparisons: bool = True,
21 ) -> None:
22     # Install deps and the package itself.
23     session.install("-r", "dev-requirements.txt")
24     session.install(f".[{extras}]")
25 
26     # Show the pip version.
27     session.run("pip", "--version")
28     # Print the Python version and bytesize.
29     session.run("python", "--version")
30     session.run("python", "-c", "import struct; print(struct.calcsize('P') * 8)")
31     # Print OpenSSL information.
32     session.run("python", "-m", "OpenSSL.debug")
33 
34     # Inspired from https://hynek.me/articles/ditch-codecov-python/
35     # We use parallel mode and then combine in a later CI step
36     session.run(
37         "python",
38         *(("-bb",) if byte_string_comparisons else ()),
39         "-m",
40         "coverage",
41         "run",
42         "--parallel-mode",
43         "-m",
44         "pytest",
45         "-r",
46         "a",
47         f"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}",
48         "--tb=native",
49         "--no-success-flaky-report",
50         *(session.posargs or ("test/",)),
51         env={"PYTHONWARNINGS": "always::DeprecationWarning"},
52     )
53 
54 
55 @nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy"])
56 def test(session: nox.Session) -> None:
57     tests_impl(session)
58 
59 
60 @nox.session(python=["2.7"])
61 def unsupported_setup_py(session: nox.Session) -> None:
62     # Can't check both returncode and output with session.run
63     process = subprocess.run(
64         ["python", "setup.py", "install"],
65         env={**session.env},
66         text=True,
67         capture_output=True,
68     )
69     assert process.returncode == 1
70     print(process.stderr)
71     assert "Please use `python -m pip install .` instead." in process.stderr
72 
73 
74 @nox.session(python=["3"])
75 def test_brotlipy(session: nox.Session) -> None:
76     """Check that if 'brotlipy' is installed instead of 'brotli' or
77     'brotlicffi' that we still don't blow up.
78     """
79     session.install("brotlipy")
80     tests_impl(session, extras="socks,secure", byte_string_comparisons=False)
81 
82 
83 def git_clone(session: nox.Session, git_url: str) -> None:
84     session.run("git", "clone", "--depth", "1", git_url, external=True)
85 
86 
87 @nox.session()
88 def downstream_botocore(session: nox.Session) -> None:
89     root = os.getcwd()
90     tmp_dir = session.create_tmp()
91 
92     session.cd(tmp_dir)
93     git_clone(session, "https://github.com/boto/botocore")
94     session.chdir("botocore")
95     session.run(
96         "git",
97         "apply",
98         f"{root}/ci/0001-Mark-100-Continue-tests-as-failing.patch",
99         external=True,
100     )
101     session.run("git", "rev-parse", "HEAD", external=True)
102     session.run("python", "scripts/ci/install")
103 
104     session.cd(root)
105     session.install(".", silent=False)
106     session.cd(f"{tmp_dir}/botocore")
107 
108     session.run("python", "-c", "import urllib3; print(urllib3.__version__)")
109     session.run("python", "scripts/ci/run-tests")
110 
111 
112 @nox.session()
113 def downstream_requests(session: nox.Session) -> None:
114     root = os.getcwd()
115     tmp_dir = session.create_tmp()
116 
117     session.cd(tmp_dir)
118     git_clone(session, "https://github.com/psf/requests")
119     session.chdir("requests")
120     session.run("git", "apply", f"{root}/ci/requests.patch", external=True)
121     session.run("git", "rev-parse", "HEAD", external=True)
122     session.install(".[socks]", silent=False)
123     session.install("-r", "requirements-dev.txt", silent=False)
124 
125     session.cd(root)
126     session.install(".", silent=False)
127     session.cd(f"{tmp_dir}/requests")
128 
129     session.run("python", "-c", "import urllib3; print(urllib3.__version__)")
130     session.run("pytest", "tests")
131 
132 
133 @nox.session()
134 def format(session: nox.Session) -> None:
135     """Run code formatters."""
136     session.install("pre-commit")
137     session.run("pre-commit", "--version")
138 
139     process = subprocess.run(
140         ["pre-commit", "run", "--all-files"],
141         env=session.env,
142         text=True,
143         stdout=subprocess.PIPE,
144         stderr=subprocess.STDOUT,
145     )
146     # Ensure that pre-commit itself ran successfully
147     assert process.returncode in (0, 1)
148 
149     lint(session)
150 
151 
152 @nox.session
153 def lint(session: nox.Session) -> None:
154     session.install("pre-commit")
155     session.run("pre-commit", "run", "--all-files")
156 
157     mypy(session)
158 
159 
160 @nox.session(python="3.8")
161 def mypy(session: nox.Session) -> None:
162     """Run mypy."""
163     session.install("-r", "mypy-requirements.txt")
164     session.run("mypy", "--version")
165     session.run(
166         "mypy",
167         "dummyserver",
168         "noxfile.py",
169         "src/urllib3",
170         "test",
171     )
172 
173 
174 @nox.session
175 def docs(session: nox.Session) -> None:
176     session.install("-r", "docs/requirements.txt")
177     session.install(".[socks,secure,brotli,zstd]")
178 
179     session.chdir("docs")
180     if os.path.exists("_build"):
181         shutil.rmtree("_build")
182     session.run("sphinx-build", "-b", "html", "-W", ".", "_build/html")
183
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -133,19 +133,6 @@
 @nox.session()
 def format(session: nox.Session) -> None:
     """Run code formatters."""
-    session.install("pre-commit")
-    session.run("pre-commit", "--version")
-
-    process = subprocess.run(
-        ["pre-commit", "run", "--all-files"],
-        env=session.env,
-        text=True,
-        stdout=subprocess.PIPE,
-        stderr=subprocess.STDOUT,
-    )
-    # Ensure that pre-commit itself ran successfully
-    assert process.returncode in (0, 1)
-
     lint(session)

{"golden_diff": "diff --git a/noxfile.py b/noxfile.py\n--- a/noxfile.py\n+++ b/noxfile.py\n@@ -133,19 +133,6 @@\n @nox.session()\n def format(session: nox.Session) -> None:\n     \"\"\"Run code formatters.\"\"\"\n-    session.install(\"pre-commit\")\n-    session.run(\"pre-commit\", \"--version\")\n-\n-    process = subprocess.run(\n-        [\"pre-commit\", \"run\", \"--all-files\"],\n-        env=session.env,\n-        text=True,\n-        stdout=subprocess.PIPE,\n-        stderr=subprocess.STDOUT,\n-    )\n-    # Ensure that pre-commit itself ran successfully\n-    assert process.returncode in (0, 1)\n-\n     lint(session)\n", "issue": "`format` session fail to run locally on Window platform\n### Subject\r\nWhen I ran `nox -rs format` to format the files,  the format process terminates due to `FileNotFoundError` reported at line 139 at file `noxfile.py`:\r\n\r\n![image](https://user-images.githubusercontent.com/23013350/184066564-3a322445-c7b8-48ba-8ee9-4e747e964037.png)\r\n\r\n\r\n### Environment\r\nWindow 10\r\n\r\n### Steps to Reproduce\r\nJust ran `nox -rs format` on Window machine.\r\n\r\n\r\nI suspect the created `process` could not find the files properly, and my workaround is to using `session.run()` instead:\r\n```python\r\n@nox.session()\r\ndef format(session: nox.Session) -> None:\r\n    \"\"\"Run code formatters.\"\"\"\r\n    session.install(\"pre-commit\")\r\n    session.run(\"pre-commit\", \"--version\")\r\n\r\n    # process = subprocess.run(\r\n    #     [\"pre-commit\", \"run\", \"--all-files\"],\r\n    #     env=session.env,\r\n    #     text=True,\r\n    #     stdout=subprocess.PIPE,\r\n    #     stderr=subprocess.STDOUT,\r\n    # )\r\n    # # Ensure that pre-commit itself ran successfully\r\n    # assert process.returncode in (0, 1)\r\n\r\n    session.run(\"pre-commit\", \"run\", \"--all-files\") # my workaround\r\n\r\n    lint(session)\r\n```\r\n\r\nPerhaps this failure is due to my improper environment setup for the repo. If so, please correct me.\r\n\r\nThanks.\n", "before_files": [{"content": "import os\nimport shutil\nimport subprocess\n\nimport nox\n\nSOURCE_FILES = [\n    \"docs/\",\n    \"dummyserver/\",\n    \"src/\",\n    \"test/\",\n    \"noxfile.py\",\n    \"setup.py\",\n]\n\n\ndef tests_impl(\n    session: nox.Session,\n    extras: str = \"socks,secure,brotli,zstd\",\n    byte_string_comparisons: bool = True,\n) -> None:\n    # Install deps and the package itself.\n    session.install(\"-r\", \"dev-requirements.txt\")\n    session.install(f\".[{extras}]\")\n\n    # Show the pip version.\n    session.run(\"pip\", \"--version\")\n    # Print the Python version and bytesize.\n    session.run(\"python\", \"--version\")\n    session.run(\"python\", \"-c\", \"import struct; print(struct.calcsize('P') * 8)\")\n    # Print OpenSSL information.\n    session.run(\"python\", \"-m\", \"OpenSSL.debug\")\n\n    # Inspired from https://hynek.me/articles/ditch-codecov-python/\n    # We use parallel mode and then combine in a later CI step\n    session.run(\n        \"python\",\n        *((\"-bb\",) if byte_string_comparisons else ()),\n        \"-m\",\n        \"coverage\",\n        \"run\",\n        \"--parallel-mode\",\n        \"-m\",\n        \"pytest\",\n        \"-r\",\n        \"a\",\n        f\"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}\",\n        \"--tb=native\",\n        \"--no-success-flaky-report\",\n        *(session.posargs or (\"test/\",)),\n        env={\"PYTHONWARNINGS\": \"always::DeprecationWarning\"},\n    )\n\n\n@nox.session(python=[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy\"])\ndef test(session: nox.Session) -> None:\n    tests_impl(session)\n\n\n@nox.session(python=[\"2.7\"])\ndef unsupported_setup_py(session: nox.Session) -> None:\n    # Can't check both returncode and output with session.run\n    process = subprocess.run(\n        [\"python\", \"setup.py\", \"install\"],\n        env={**session.env},\n        text=True,\n        capture_output=True,\n    )\n    assert process.returncode == 1\n    print(process.stderr)\n    assert \"Please use `python -m pip install .` instead.\" in process.stderr\n\n\n@nox.session(python=[\"3\"])\ndef test_brotlipy(session: nox.Session) -> None:\n    \"\"\"Check that if 'brotlipy' is installed instead of 'brotli' or\n    'brotlicffi' that we still don't blow up.\n    \"\"\"\n    session.install(\"brotlipy\")\n    tests_impl(session, extras=\"socks,secure\", byte_string_comparisons=False)\n\n\ndef git_clone(session: nox.Session, git_url: str) -> None:\n    session.run(\"git\", \"clone\", \"--depth\", \"1\", git_url, external=True)\n\n\n@nox.session()\ndef downstream_botocore(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/boto/botocore\")\n    session.chdir(\"botocore\")\n    session.run(\n        \"git\",\n        \"apply\",\n        f\"{root}/ci/0001-Mark-100-Continue-tests-as-failing.patch\",\n        external=True,\n    )\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.run(\"python\", \"scripts/ci/install\")\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/botocore\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"python\", \"scripts/ci/run-tests\")\n\n\n@nox.session()\ndef downstream_requests(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/psf/requests\")\n    session.chdir(\"requests\")\n    session.run(\"git\", \"apply\", f\"{root}/ci/requests.patch\", external=True)\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.install(\".[socks]\", silent=False)\n    session.install(\"-r\", \"requirements-dev.txt\", silent=False)\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/requests\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"pytest\", \"tests\")\n\n\n@nox.session()\ndef format(session: nox.Session) -> None:\n    \"\"\"Run code formatters.\"\"\"\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"--version\")\n\n    process = subprocess.run(\n        [\"pre-commit\", \"run\", \"--all-files\"],\n        env=session.env,\n        text=True,\n        stdout=subprocess.PIPE,\n        stderr=subprocess.STDOUT,\n    )\n    # Ensure that pre-commit itself ran successfully\n    assert process.returncode in (0, 1)\n\n    lint(session)\n\n\n@nox.session\ndef lint(session: nox.Session) -> None:\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"run\", \"--all-files\")\n\n    mypy(session)\n\n\n@nox.session(python=\"3.8\")\ndef mypy(session: nox.Session) -> None:\n    \"\"\"Run mypy.\"\"\"\n    session.install(\"-r\", \"mypy-requirements.txt\")\n    session.run(\"mypy\", \"--version\")\n    session.run(\n        \"mypy\",\n        \"dummyserver\",\n        \"noxfile.py\",\n        \"src/urllib3\",\n        \"test\",\n    )\n\n\n@nox.session\ndef docs(session: nox.Session) -> None:\n    session.install(\"-r\", \"docs/requirements.txt\")\n    session.install(\".[socks,secure,brotli,zstd]\")\n\n    session.chdir(\"docs\")\n    if os.path.exists(\"_build\"):\n        shutil.rmtree(\"_build\")\n    session.run(\"sphinx-build\", \"-b\", \"html\", \"-W\", \".\", \"_build/html\")\n", "path": "noxfile.py"}], "after_files": [{"content": "import os\nimport shutil\nimport subprocess\n\nimport nox\n\nSOURCE_FILES = [\n    \"docs/\",\n    \"dummyserver/\",\n    \"src/\",\n    \"test/\",\n    \"noxfile.py\",\n    \"setup.py\",\n]\n\n\ndef tests_impl(\n    session: nox.Session,\n    extras: str = \"socks,secure,brotli,zstd\",\n    byte_string_comparisons: bool = True,\n) -> None:\n    # Install deps and the package itself.\n    session.install(\"-r\", \"dev-requirements.txt\")\n    session.install(f\".[{extras}]\")\n\n    # Show the pip version.\n    session.run(\"pip\", \"--version\")\n    # Print the Python version and bytesize.\n    session.run(\"python\", \"--version\")\n    session.run(\"python\", \"-c\", \"import struct; print(struct.calcsize('P') * 8)\")\n    # Print OpenSSL information.\n    session.run(\"python\", \"-m\", \"OpenSSL.debug\")\n\n    # Inspired from https://hynek.me/articles/ditch-codecov-python/\n    # We use parallel mode and then combine in a later CI step\n    session.run(\n        \"python\",\n        *((\"-bb\",) if byte_string_comparisons else ()),\n        \"-m\",\n        \"coverage\",\n        \"run\",\n        \"--parallel-mode\",\n        \"-m\",\n        \"pytest\",\n        \"-r\",\n        \"a\",\n        f\"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}\",\n        \"--tb=native\",\n        \"--no-success-flaky-report\",\n        *(session.posargs or (\"test/\",)),\n        env={\"PYTHONWARNINGS\": \"always::DeprecationWarning\"},\n    )\n\n\n@nox.session(python=[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy\"])\ndef test(session: nox.Session) -> None:\n    tests_impl(session)\n\n\n@nox.session(python=[\"2.7\"])\ndef unsupported_setup_py(session: nox.Session) -> None:\n    # Can't check both returncode and output with session.run\n    process = subprocess.run(\n        [\"python\", \"setup.py\", \"install\"],\n        env={**session.env},\n        text=True,\n        capture_output=True,\n    )\n    assert process.returncode == 1\n    print(process.stderr)\n    assert \"Please use `python -m pip install .` instead.\" in process.stderr\n\n\n@nox.session(python=[\"3\"])\ndef test_brotlipy(session: nox.Session) -> None:\n    \"\"\"Check that if 'brotlipy' is installed instead of 'brotli' or\n    'brotlicffi' that we still don't blow up.\n    \"\"\"\n    session.install(\"brotlipy\")\n    tests_impl(session, extras=\"socks,secure\", byte_string_comparisons=False)\n\n\ndef git_clone(session: nox.Session, git_url: str) -> None:\n    session.run(\"git\", \"clone\", \"--depth\", \"1\", git_url, external=True)\n\n\n@nox.session()\ndef downstream_botocore(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/boto/botocore\")\n    session.chdir(\"botocore\")\n    session.run(\n        \"git\",\n        \"apply\",\n        f\"{root}/ci/0001-Mark-100-Continue-tests-as-failing.patch\",\n        external=True,\n    )\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.run(\"python\", \"scripts/ci/install\")\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/botocore\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"python\", \"scripts/ci/run-tests\")\n\n\n@nox.session()\ndef downstream_requests(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/psf/requests\")\n    session.chdir(\"requests\")\n    session.run(\"git\", \"apply\", f\"{root}/ci/requests.patch\", external=True)\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.install(\".[socks]\", silent=False)\n    session.install(\"-r\", \"requirements-dev.txt\", silent=False)\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/requests\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"pytest\", \"tests\")\n\n\n@nox.session()\ndef format(session: nox.Session) -> None:\n    \"\"\"Run code formatters.\"\"\"\n    lint(session)\n\n\n@nox.session\ndef lint(session: nox.Session) -> None:\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"run\", \"--all-files\")\n\n    mypy(session)\n\n\n@nox.session(python=\"3.8\")\ndef mypy(session: nox.Session) -> None:\n    \"\"\"Run mypy.\"\"\"\n    session.install(\"-r\", \"mypy-requirements.txt\")\n    session.run(\"mypy\", \"--version\")\n    session.run(\n        \"mypy\",\n        \"dummyserver\",\n        \"noxfile.py\",\n        \"src/urllib3\",\n        \"test\",\n    )\n\n\n@nox.session\ndef docs(session: nox.Session) -> None:\n    session.install(\"-r\", \"docs/requirements.txt\")\n    session.install(\".[socks,secure,brotli,zstd]\")\n\n    session.chdir(\"docs\")\n    if os.path.exists(\"_build\"):\n        shutil.rmtree(\"_build\")\n    session.run(\"sphinx-build\", \"-b\", \"html\", \"-W\", \".\", \"_build/html\")\n", "path": "noxfile.py"}]}