Skip to content

Commit 75c662c

Browse files
committed
feat(core): error if tcp perm denied
While in live-preview mode connecting to an already used port or a port which is reserved for elevated users, fleck now logs the resulting error from 'http.ListenAndServe' via the 'logger.LError' utility. Fleck's output while trying to serve at port 80 without elevated privileges: $ fleck --port=80 --live-preview README.md 2023/04/24 09:57:44 info: starting live preview 2023/04/24 09:57:44 info: listening on http://localhost:80/README.html 2023/04/24 09:57:44 error: listen tcp :80: bind: permission denied exit status 1
1 parent 1570018 commit 75c662c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func LivePreview(fileName string) {
116116

117117
logger.LInfo("listening on http://localhost:" + port + "/" + file + ".html")
118118
spawnDefaultBrowser("http://localhost:" + port + "/" + file + ".html")
119-
http.ListenAndServe(":"+port, nil)
119+
logger.LError(http.ListenAndServe(":"+port, nil).Error())
120120
}
121121

122122
// watches for changes in a file, recompiles the file if a change occurs, can be exited via <C-c>

0 commit comments

Comments
 (0)