Commit c3ad7a9
authored
Enhance bin/dev kill to terminate processes on ports 3000 and 3001 (#1846)
Previously, `bin/dev kill` only terminated processes by pattern matching
(e.g., "rails", "puma", "webpack-dev-server"). This could miss processes
that were holding ports 3000 or 3001 but didn't match the patterns.
Now `bin/dev kill` also finds and terminates any process listening on
ports 3000 and 3001 using `lsof -ti:PORT`, ensuring a clean restart
even when unexpected processes are blocking the development ports.
Changes:
- Add kill_port_processes(ports) method to find and kill processes on specific ports
- Add find_port_pids(port) helper that uses lsof to find PIDs listening on a port
- Update kill_processes to call kill_port_processes([3000, 3001])
- Add comprehensive tests for port-killing functionality
- Handle edge cases (lsof not found, permission denied) gracefully
The port-killing is integrated as default behavior (no --force flag needed)
since ports 3000/3001 are explicitly development ports and this matches
the existing UX where kill doesn't ask for confirmation.1 parent 62d92e1 commit c3ad7a9
File tree
2 files changed
+97
-1
lines changed- lib/react_on_rails/dev
- spec/react_on_rails/dev
2 files changed
+97
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
78 | 101 | | |
79 | 102 | | |
80 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
| |||
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
120 | 140 | | |
121 | 141 | | |
122 | 142 | | |
| |||
130 | 150 | | |
131 | 151 | | |
132 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
133 | 206 | | |
134 | 207 | | |
135 | 208 | | |
| |||
0 commit comments