1
0
mirror of https://github.com/firstBitMarksistskaya/jenkins-lib.git synced 2025-08-25 20:09:25 +02:00

modify pid command

This commit is contained in:
Dima
2024-12-13 15:30:36 +03:00
parent 21265421fa
commit 5327243e9f

View File

@@ -20,7 +20,14 @@ class CoverageUtils {
script = "ps -aux | grep '$name' | grep -v grep | awk '{print \$2}'"
pids = steps.sh(script, false, true, 'UTF-8')
} else {
script = "@echo off\nchcp 65001 > nul\nfor /f \"tokens=2\" %%a in ('tasklist ^| findstr \"$name\" || exit 0') do (@echo %%a)"
script = """@echo off
chcp 65001 > nul
tasklist | findstr "${name}" > nul
if errorlevel 1 (
exit /b 0
) else (
for /f "tokens=2" %%a in ('tasklist ^| findstr "${name}"') do (@echo %%a)
)"""
pids = steps.bat(script, false, true, 'UTF-8')
}
return pids.split('\r?\n').toList()