OK, I've made this script for Linux that seems to work (well, it still 
needs CTRL+C to close the terminal, but then the port is closed).

 Script "main.html.sh" in the same folder as main.html

> #!/bin/bash
> source /.../emsdk/path_to_my_emsdk_env.sh
> # Check and close port if open
> MYPID=`lsof -i :6931 | sed -n '2p' | awk '{print $2}'`
> if [ -n "${MYPID}" ]; then
>     #echo $MYPID
>     kill $MYPID
> fi
> # Execute html
> emrun --kill_start --kill_exit main.html
> # Check and close port if open
> MYPID=`lsof -i :6931 | sed -n '2p' | awk '{print $2}'`
> if [ -n "${MYPID}" ]; then
>     #echo $MYPID
>     kill $MYPID
> fi
>
>
It's not perfect and there are better solutions for sure, but to me it's 
enough.

Hope it helps.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/6cd2ae71-dfcb-414f-b5b1-181e8cde27ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to