Skip to content

Commit 4968caa

Browse files
committed
Handle CREATE_NO_WINDOW subprocess flag value (only available on Windows)
1 parent 5c84958 commit 4968caa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pylsp_ruff/plugin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@
77
import sys
88
from functools import lru_cache
99
from pathlib import PurePath
10-
from subprocess import CREATE_NO_WINDOW, PIPE, Popen
10+
from subprocess import PIPE, Popen
1111
from typing import Dict, Generator, List, Optional
1212

13+
if sys.platform == "win32":
14+
from subprocess import CREATE_NO_WINDOW
15+
else:
16+
# CREATE_NO_WINDOW flag only available on Windows.
17+
# Set constant as default `Popen` `creationflag` kwarg value (`0`)
18+
CREATE_NO_WINDOW = 0
19+
1320
if sys.version_info >= (3, 11):
1421
import tomllib
1522
else:

0 commit comments

Comments
 (0)