Skip to content

Commit f17ab92

Browse files
johnstcnmafredri
andauthored
chore: improve message when running develop.sh multiple times (#19333)
`develop.sh` checks for existing processes listening on port 3000 or 8080. We can check if it's the development server to avoid confusion. --------- Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
1 parent 791d39c commit f17ab92

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 --silent --fail http://127.0.0.1:3000; 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy