Skip to content

Commit 7d2a915

Browse files
committed
chore: improve message when running develop.sh multiple times
1 parent 791d39c commit 7d2a915

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

scripts/develop.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,25 @@ if [ -n "${CODER_AGENT_URL:-}" ]; then
7272
fi
7373

7474
# Preflight checks: ensure we have our required dependencies, and make sure nothing is listening on port 3000 or 8080
75-
dependencies curl git go make pnpm
76-
curl --fail http://127.0.0.1:3000 >/dev/null 2>&1 && echo '== ERROR: something is listening on port 3000. Kill it and re-run this script.' && exit 1
77-
curl --fail http://127.0.0.1:8080 >/dev/null 2>&1 && echo '== ERROR: something is listening on port 8080. Kill it and re-run this script.' && exit 1
75+
dependencies curl git go jq make pnpm
76+
77+
if curl --fail http://127.0.0.1:3000 >/dev/null 2>&1; then
78+
# Check if this is the Coder development server.
79+
if curl --silent --fail http://127.0.0.1:3000/api/v2/buildinfo 2>&1 | jq -r '.version' >/dev/null 2>&1; then
80+
echo '== INFO: Coder development server is already running on port 3000!' && exit 0
81+
else
82+
echo '== ERROR: something is listening on port 3000. Kill it and re-run this script.' && exit 1
83+
fi
84+
fi
85+
86+
if curl --fail http://127.0.0.1:8080 >/dev/null 2>&1; then
87+
# Check if this is the Coder development frontend.
88+
if curl --silent --fail http://127.0.0.1:8080/api/v2/buildinfo 2>&1 | jq -r '.version' >/dev/null 2>&1; then
89+
echo '== INFO: Coder development frontend is already running on port 8080!' && exit 0
90+
else
91+
echo '== ERROR: something is listening on port 8080. Kill it and re-run this script.' && exit 1
92+
fi
93+
fi
7894

7995
# Compile the CLI binary. This should also compile the frontend and refresh
8096
# node_modules if necessary.

0 commit comments

Comments
 (0)