|
7 | 7 | import sys |
8 | 8 | from functools import lru_cache |
9 | 9 | from pathlib import PurePath |
10 | | -from subprocess import PIPE, Popen |
| 10 | +from subprocess import CREATE_NO_WINDOW, PIPE, Popen |
11 | 11 | from typing import Dict, Generator, List, Optional |
12 | 12 |
|
13 | 13 | if sys.version_info >= (3, 11): |
@@ -502,7 +502,7 @@ def find_executable(executable) -> List[str]: |
502 | 502 | # try the python module |
503 | 503 | if cmd is None: |
504 | 504 | if importlib.util.find_spec("ruff") is not None: |
505 | | - cmd = [sys.executable, "-m", "ruff"] |
| 505 | + cmd = [sys.executable.replace("pythonw", "python"), "-m", "ruff"] |
506 | 506 |
|
507 | 507 | # try system's ruff executable |
508 | 508 | if cmd is None: |
@@ -557,7 +557,7 @@ def run_ruff( |
557 | 557 | cmd = [*find_executable(executable), str(subcommand), *arguments] |
558 | 558 |
|
559 | 559 | log.debug(f"Calling {cmd} on '{document_path}'") |
560 | | - p = Popen(cmd, stdin=PIPE, stdout=PIPE) |
| 560 | + p = Popen(cmd, stdin=PIPE, stdout=PIPE, creationflags=CREATE_NO_WINDOW) |
561 | 561 | (stdout, _) = p.communicate(document_source.encode()) |
562 | 562 |
|
563 | 563 | if p.returncode != 0: |
|
0 commit comments