Skip to content

Commit e2c5144

Browse files
committed
update dev.sh script
1 parent d065057 commit e2c5144

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

scripts/dev.sh

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ set -e
66
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
77
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
88

9+
# Detect OS
10+
OS="unknown"
11+
case "$(uname -s)" in
12+
Linux*) OS="linux";;
13+
Darwin*) OS="macos";;
14+
CYGWIN*|MINGW*|MSYS*) OS="windows";;
15+
*) OS="unknown";;
16+
esac
17+
918
# Colors for output
1019
RED='\033[0;31m'
1120
GREEN='\033[0;32m'
@@ -14,7 +23,9 @@ NC='\033[0m' # No Color
1423

1524
print_header() {
1625
echo -e "${GREEN}🚄 Hyperloop H10 Development Environment${NC}"
17-
echo -e "${GREEN}=====================================>${NC}"
26+
echo -e "${GREEN}=======================================${NC}"
27+
echo -e "${YELLOW}OS: $OS${NC}"
28+
echo ""
1829
}
1930

2031
print_usage() {
@@ -103,8 +114,37 @@ run_packet_sender() {
103114
}
104115

105116
run_all_tmux() {
117+
if [ "$OS" = "windows" ]; then
118+
echo -e "${YELLOW}Note: Running all services in parallel on Windows...${NC}"
119+
echo -e "${YELLOW}Use Ctrl+C to stop all services${NC}"
120+
121+
# Start all services in background
122+
(cd "$PROJECT_ROOT/backend/cmd" && go run .) &
123+
PID_BACKEND=$!
124+
125+
(cd "$PROJECT_ROOT/ethernet-view" && npm run dev) &
126+
PID_ETHERNET=$!
127+
128+
(cd "$PROJECT_ROOT/control-station" && npm run dev) &
129+
PID_CONTROL=$!
130+
131+
(cd "$PROJECT_ROOT/packet-sender" && go run .) &
132+
PID_PACKET=$!
133+
134+
echo -e "${GREEN}All services started. PIDs: Backend=$PID_BACKEND, Ethernet=$PID_ETHERNET, Control=$PID_CONTROL, Packet=$PID_PACKET${NC}"
135+
136+
# Wait for any process to exit or Ctrl+C
137+
wait
138+
139+
# Kill all background processes
140+
kill $PID_BACKEND $PID_ETHERNET $PID_CONTROL $PID_PACKET 2>/dev/null || true
141+
echo -e "${YELLOW}All services stopped${NC}"
142+
return
143+
fi
144+
106145
if ! command -v tmux >/dev/null 2>&1; then
107-
echo -e "${RED}Error: tmux is required to run all services${NC}"
146+
echo -e "${RED}Error: tmux is required to run all services on Unix systems${NC}"
147+
echo -e "${YELLOW}Tip: Install tmux or run services individually${NC}"
108148
exit 1
109149
fi
110150

0 commit comments

Comments
 (0)