Skip to content

Commit fde69d8

Browse files
committed
ci update
1 parent d1a4806 commit fde69d8

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

tests/conftest.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,34 @@ def setup_stackql():
4848
# Return the StackQL instance for use in tests
4949
return stackql
5050

51+
# def stackql_process_running():
52+
# try:
53+
# if platform.system() == "Windows":
54+
# # Use `tasklist` to look for stackql.exe with correct port in args (may not include args, so fallback is loose match)
55+
# output = subprocess.check_output(['tasklist', '/FI', 'IMAGENAME eq stackql.exe'], text=True)
56+
# return "stackql.exe" in output
57+
# else:
58+
# # Use `ps aux` to search for 'stackql' process with the correct port
59+
# output = subprocess.check_output(['ps', 'aux'], text=True)
60+
# return f"--pgsrv.port={SERVER_PORT}" in output and "stackql" in output
61+
# except subprocess.CalledProcessError:
62+
# return False
63+
5164
def stackql_process_running():
5265
try:
5366
if platform.system() == "Windows":
54-
# Use `tasklist` to look for stackql.exe with correct port in args (may not include args, so fallback is loose match)
55-
output = subprocess.check_output(['tasklist', '/FI', 'IMAGENAME eq stackql.exe'], text=True)
67+
output = subprocess.check_output(
68+
['tasklist', '/FI', 'IMAGENAME eq stackql.exe'], text=True
69+
)
5670
return "stackql.exe" in output
5771
else:
58-
# Use `ps aux` to search for 'stackql' process with the correct port
59-
output = subprocess.check_output(['ps', 'aux'], text=True)
60-
return f"--pgsrv.port={SERVER_PORT}" in output and "stackql" in output
72+
# More reliable: use pgrep + full argument check
73+
output = subprocess.check_output(
74+
f"ps aux | grep '[s]tackql' | grep -- '--pgsrv.port={SERVER_PORT}'",
75+
shell=True,
76+
text=True
77+
)
78+
return bool(output.strip())
6179
except subprocess.CalledProcessError:
6280
return False
6381

0 commit comments

Comments
 (0)