Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/386/go/doc/articles/wiki/final-test.patch

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


--- final.go	2017-08-31 13:19:00.422925489 -0700
+++ final-test.go	2017-08-31 13:23:43.381391659 -0700
@@ -8,6 +8,7 @@
 	"html/template"
 	"io/ioutil"
 	"log"
+	"net"
 	"net/http"
 	"regexp"
 )
@@ -86,5 +87,15 @@
 	http.HandleFunc("/edit/", makeHandler(editHandler))
 	http.HandleFunc("/save/", makeHandler(saveHandler))
 
-	log.Fatal(http.ListenAndServe(":8080", nil))
+	l, err := net.Listen("tcp", "127.0.0.1:0")
+	if err != nil {
+		log.Fatal(err)
+	}
+	err = ioutil.WriteFile("final-test-port.txt", []byte(l.Addr().String()), 0644)
+	if err != nil {
+		log.Fatal(err)
+	}
+	s := &http.Server{}
+	s.Serve(l)
+	return
 }

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.