Skip to content

Commit

Permalink
modify pid command
Browse files Browse the repository at this point in the history
  • Loading branch information
ovcharenko-di committed Dec 13, 2024
1 parent 2126542 commit 5327243
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ru/pulsar/jenkins/library/utils/CoverageUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5327243

Please sign in to comment.