Skip to content

Commit ecf286e

Browse files
committed
fixup! Improve error handling using a fail-fast approach
1 parent b9f5ec0 commit ecf286e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/stopNeo4j.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ else
5050
fi
5151

5252
# Check if there are still processes running that listen to the Neo4j HTTP port
53-
port_listener_process_id=$( lsof -t -i:"${NEO4J_HTTP_PORT}" -sTCP:LISTEN )
54-
if echo -n "${port_listener_process_id}" | grep -q ".*"; then
53+
port_listener_process_id=$( lsof -t -i:"${NEO4J_HTTP_PORT}" -sTCP:LISTEN || true )
54+
if [ -n "${port_listener_process_id}" ]; then
5555
echo "stopNeo4j: Terminating the following process that still listens to port ${NEO4J_HTTP_PORT}"
5656
ps -p "${port_listener_process_id}"
5757
# Terminate the process that is listening to the Neo4j HTTP port

0 commit comments

Comments
 (0)