pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python-lsp/python-lsp-ruff/pull/108/files

github.githubassets.com/assets/primer-primitives-ef1311e26457f1ec.css" /> Prevent showing cmd on Windows and add handling for ruff execution with `pythonw` by dalthviz · Pull Request #108 · python-lsp/python-lsp-ruff · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ __pycache__/
*.swp
tags
/build/

.spyproject/
11 changes: 9 additions & 2 deletions pylsp_ruff/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
from subprocess import PIPE, Popen
from typing import Dict, Generator, List, Optional

if sys.platform == "win32":
from subprocess import CREATE_NO_WINDOW
else:
# CREATE_NO_WINDOW flag only available on Windows.
# Set constant as default `Popen` `creationflag` kwarg value (`0`)
CREATE_NO_WINDOW = 0

if sys.version_info >= (3, 11):
import tomllib
else:
Expand Down Expand Up @@ -502,7 +509,7 @@ def find_executable(executable) -> List[str]:
# try the python module
if cmd is None:
if importlib.util.find_spec("ruff") is not None:
cmd = [sys.executable, "-m", "ruff"]
cmd = [sys.executable.replace("pythonw", "python"), "-m", "ruff"]

# try system's ruff executable
if cmd is None:
Expand Down Expand Up @@ -557,7 +564,7 @@ def run_ruff(
cmd = [*find_executable(executable), str(subcommand), *arguments]

log.debug(f"Calling {cmd} on '{document_path}'")
p = Popen(cmd, stdin=PIPE, stdout=PIPE)
p = Popen(cmd, stdin=PIPE, stdout=PIPE, creationflags=CREATE_NO_WINDOW)
(stdout, _) = p.communicate(document_source.encode())

if p.returncode != 0:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy