Skip to content

Commit

Permalink
Svcctl shall not steal ports
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbarsky committed Oct 10, 2024
1 parent 106982e commit 3ef4e9b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/svcinit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ func main() {
unversionedSpecs, err := readServiceSpecs(serviceSpecsPath)
must(err)

ports, err := assignPorts(unversionedSpecs)
// Make sure we grab the svcctl port before we assign test ports,
// otherwise we might steal an assigned port by accident.
listener, err := net.Listen("tcp", "127.0.0.1:0")
must(err)

listener, err := net.Listen("tcp", "127.0.0.1:0")
ports, err := assignPorts(unversionedSpecs)
must(err)

svcctlPort := listener.Addr().(*net.TCPAddr).Port
Expand Down

0 comments on commit 3ef4e9b

Please sign in to comment.