Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Report lingering processes to the user
Browse files Browse the repository at this point in the history
  • Loading branch information
sgirones authored and bcomnes committed Nov 15, 2018
1 parent 21e2b46 commit b3d65d7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
29 changes: 29 additions & 0 deletions run-build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -623,3 +623,32 @@ set_go_import_path() {
cd $importPath
fi
}

find_running_procs() {
ps aux | grep -v [p]s | grep -v [g]rep | grep -v [b]ash
}

report_lingering_procs() {
procs=$(find_running_procs)
nprocs=$(expr $(echo "$procs" | wc -l) - 1)
if [[ $nprocs > 0 ]]; then
echo -e "${YELLOW}"
echo "** WARNING **"
echo "There are some lingering processes even after the build process finished: "
echo
echo "$procs"
echo
echo "Our builds do not kill your processes automatically, so please make sure"
echo "that nothing is running after your build finishes, or it will be marked as"
echo "failed since something is still running."
echo -e "${NC}"
fi
}

after_build_steps() {
echo "Caching artifacts"
cache_artifacts

# Find lingering processes after the build finished and report it to the user
report_lingering_procs
}
3 changes: 1 addition & 2 deletions run-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ echo "Executing user command: $cmd"
eval "$cmd"
CODE=$?

echo "Caching artifacts"
cache_artifacts
after_build_steps

exit $CODE

0 comments on commit b3d65d7

Please sign in to comment.