Skip to content

Commit 2748ae7

Browse files
committed
fixup! Improve error handling using a fail-fast approach
1 parent 9c869b5 commit 2748ae7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/startNeo4j.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ if [ -n "${neo4jNotRunning}" ]; then
4949
echo "startNeo4j: Starting neo4j-${NEO4J_EDITION}-${NEO4J_VERSION} in ${NEO4J_DIR}"
5050

5151
# Check if there is already a process that listens to the Neo4j HTTP port
52-
port_listener_process_id=$( lsof -t -i:"${NEO4J_HTTP_PORT}" -sTCP:LISTEN )
53-
if echo -n "${port_listener_process_id}" | grep -q ".*"; then
52+
port_listener_process_id=$( lsof -t -i:"${NEO4J_HTTP_PORT}" -sTCP:LISTEN || true )
53+
if [ -z "${port_listener_process_id}" ]; then
5454
echo "startNeo4j: There is already a process that listens to port ${NEO4J_HTTP_PORT}"
5555
ps -p "${port_listener_process_id}"
5656
echo "startNeo4j: Use this command to stop it: kill -9 \$( lsof -t -i:${NEO4J_HTTP_PORT} -sTCP:LISTEN )"

0 commit comments

Comments
 (0)