webui: open browser in new window

This gets closer to an app like feeling
This commit is contained in:
DavHau
2023-10-04 16:54:24 +02:00
parent 018590d30b
commit 544322ee6e
3 changed files with 51 additions and 14 deletions

View File

@@ -5,15 +5,17 @@ import subprocess
import sys
from pathlib import Path
import pytest
from ports import PortFunction
@pytest.mark.timeout(10)
def test_start_server(unused_tcp_port: PortFunction, temporary_dir: Path) -> None:
port = unused_tcp_port()
fifo = temporary_dir / "fifo"
os.mkfifo(fifo)
notify_script = temporary_dir / "notify.sh"
notify_script = temporary_dir / "firefox"
bash = shutil.which("bash")
assert bash is not None
notify_script.write_text(
@@ -25,7 +27,8 @@ echo "1" > {fifo}
notify_script.chmod(0o700)
env = os.environ.copy()
env["BROWSER"] = str(notify_script)
print(str(temporary_dir.absolute()))
env["PATH"] = ":".join([str(temporary_dir.absolute())] + env["PATH"].split(":"))
with subprocess.Popen(
[sys.executable, "-m", "clan_cli.webui", "--port", str(port)], env=env
) as p: