Skip to content

Commit e556455

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

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pylsp_ruff/plugin.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@
22
import importlib.util
33
import json
44
import logging
5+
import os
56
import re
67
import shutil
78
import sys
89
from functools import lru_cache
910
from pathlib import PurePath
10-
from subprocess import CREATE_NO_WINDOW, PIPE, Popen
11+
from subprocess import PIPE, Popen
1112
from typing import Dict, Generator, List, Optional
1213

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

0 commit comments

Comments
 (0)