You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I followed the instruction for Hot Reload in you guide and after the release of v0.2.543 when i run the built in mode with:
templ generate --watch --proxy="http://localhost:8081" --cmd="go run ."
then after cancelling/stopping the watch mode with Ctrl+C a production build is started and after this the --cmd is executed again and in my case starts the server again.
stefan@home:~/Projekte/go/tests/templ-watch-issue$ templ generate --watch --proxy="http://localhost:8081" --cmd="go run ."
Processing path: /home/stefan/Projekte/go/tests/templ-watch-issue
Generating dev code: /home/stefan/Projekte/go/tests/templ-watch-issue
(✓) Generated code for"/home/stefan/Projekte/go/tests/templ-watch-issue/main.templ"in 767.498µs
(✓) Generated code for1 templates with 0 errorsin 879.651µs
Executing command: go run .
Proxying from http://127.0.0.1:7331 to target: http://localhost:8081
Opening URL: http://localhost:8081
____ __
/ __/___/ / ___
/ _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.11.4
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
O\
⇨ http server started on [::]:8081
^CStopping...
Generating production code: /home/stefan/Projekte/go/tests/templ-watch-issue
(!) Deleted file "/home/stefan/Projekte/go/tests/templ-watch-issue/main_templ.txt"
(✓) Generated code for"/home/stefan/Projekte/go/tests/templ-watch-issue/main.templ"in 687.207µs
(✓) Generated code for1 templates with 0 errorsin 798.799µs
Executing command: go run .
stefan@home:~/Projekte/go/tests/templ-watch-issue$
____ __
/ __/___/ / ___
/ _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.11.4
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
O\
⇨ http server started on [::]:8081
I can then try to stop the second launch of the server with Ctrl+C, but in this case only templ is stopped and server still lingers in the background:
stefan@home:~/Projekte/go/tests/templ-watch-issue$ netstat -tlpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::8081 :::* LISTEN 197863/templ-watch-
Two things i noticed by looking in the source code and the trace above:
The temporary text files are deleted by the "Generating production code" not after watch was stopped.
As far as i understand the run code the next run kills the previous run and not the stopping of the program with Ctrl+C.
The text was updated successfully, but these errors were encountered:
joerdav
changed the title
templ generate with watch and hot reload starts server after cancelling again and doesn't clean up
cmd: templ generate with watch and hot reload starts server after cancelling again and doesn't clean up
Jan 29, 2024
I followed the instruction for Hot Reload in you guide and after the release of v0.2.543 when i run the built in mode with:
then after cancelling/stopping the watch mode with
Ctrl+C
a production build is started and after this the--cmd
is executed again and in my case starts the server again.I created a simple application to show the issue: templ-watch-issue.zip
With this example i get the following output:
I can then try to stop the second launch of the server with
Ctrl+C
, but in this case onlytempl
is stopped and server still lingers in the background:Two things i noticed by looking in the source code and the trace above:
Ctrl+C
.The text was updated successfully, but these errors were encountered: