Skip to content

Commit

Permalink
feat(core): error if tcp perm denied
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xNaCly committed Apr 24, 2023
1 parent 1570018 commit 75c662c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func LivePreview(fileName string) {

logger.LInfo("listening on http://localhost:" + port + "/" + file + ".html")
spawnDefaultBrowser("http://localhost:" + port + "/" + file + ".html")
http.ListenAndServe(":"+port, nil)
logger.LError(http.ListenAndServe(":"+port, nil).Error())
}

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

0 comments on commit 75c662c

Please sign in to comment.