On Windows the daemon started at login runs detached from any console: the Startup entry runs troupe-daemon run --detached, which is erl -detached, the runtime's own way to run a daemon, so no window stays open and no script host is involved¶
Decision 962 · accepted · 2026-10-28 · supersedes 762
This replaces 762's Windows console part only; the rest of 762 stands (one module, each
platform's own per-user entry, only files, TROUPE_DAEMON_IDLE_MINUTES=0, the setup
step).
- What 762 was guarding against, and what it gave up. 762 said a start with no window
needs a script host (VBScript) or a hidden PowerShell, which is what malware looks like,
and took the visible window as the price. That was true of the ways
cmdandstartoffer; it is not true of the runtime.erl -detachedis Erlang's own, documented way to run a daemon on every platform: on Windows the launcher closes its standard handles, spawns the emulator again as a detached process (no console,ERL_CONSOLE_MODE=detached) and returns at once. No script host, no shell kept alive, nothing a virus scanner reads as persistence beyond the Startup folder entry itself. The window a person could see and close goes, but the desktop app has started the daemon with no window since 903'sCREATE_NO_WINDOW, so windowless is already the daemon's usual state on this platform; it is seen in Task Manager's Startup list (the folder entry) and aserl.exe, and stopped withtroupe-daemon stop, by logging out, or from Task Manager. - How the flag reaches the VM. The release script hands every command the same
vm.args, andevalmust never detach (astatusrun detached would answer nothing). Sotroupe-daemon run --detachedisbin/troupe_daemon start --detached; the release's ownenv.bat, which the script calls with the command line before it settlesRELEASE_VM_ARGS, points that atreleases/<vsn>/detached.vm.args; and thewrapperrelease step writes that file as the renderedvm.argswith-detachedafter it, so a flag added tovm.argsreaches a detached daemon too.runtakes--detachedand no other option, and arunwith a daemon already up still says where it is and exits 0. The Unix wrapper ignores the option: launchd and systemd give the daemon no terminal. - The entry keeps
start "troupe-daemon" /min cmd /c. Explorer gives a Startup item that is a batch file a console of its own, so some window exists until the wrapper has checked for a running daemon and the VM's launcher has returned, a second or two.startreturns at once, so the entry's own window is gone in a blink, and the inner one is minimised for that moment and closes by itself. Droppingstartwould leave a full-size window for those seconds instead. - Where its output goes. A detached VM has no standard output. The daemon's log has
been
daemon.login the state directory, rotated, since it was made for clients that start it detached (TROUPE_DAEMON_LOG); the one line that went only to the console, "listening at", now goes to the log as well.troupe-daemon statusfinds it throughdaemon.jsonas before. - Not chosen. A Windows service through the release's
install(erlsrv): it needs an administrator to register, runs under a service account without the person's%APPDATA%, credentials or keyring, and the release refuses it with no distribution. A scheduled task at logon: a console program run in the person's session still shows its window, hiding it means running it outside the session, it is not "only files", and Task Manager's Startup list does not show it.start /b: shares the console that started it (802).ELIXIR_ERL_OPTIONS=-detachedaround the start: the VM hands its environment to every program it starts, so an agent'smix testwould detach too. A.lnkwith "run minimised": needs COM to write, and minimises rather than hides. - An entry from before refreshes itself. A machine that had the entry before this
change would keep its console after an update until somebody ran
login onagain, and nobody would. So the daemon, as it starts to serve (Troupe.Daemon.Application's one-off task, after the "listening at" line), runsTroupe.StartAtLogin.refresh/1once: where an entry of this platform's kind is there, starts thetroupe-daemonan entry would start now (the command as that kind's entry spells it is in the text) and is not whatentry/2writes now, it is written again at the same path, and one line says so in the log. A current entry is not written (its time stays); a file at that path that starts something else is somebody else's and is left, as is any entry when notroupe-daemoncan be found; the answer says which. Still only files, nothing started, every kind alike since any entry's shape can change. The daemon is the first thing that runs after an update on every platform, which is why it is there and not in an update step:Troupe.Update,install.shandinstall.ps1have no hook after a new daemon is in place, and the installer leaves an entry it finds alone.
Governs: apps/troupe_core/lib/troupe/start_at_login.ex, apps/troupe_daemon/lib/troupe/daemon/release.ex, apps/troupe_daemon/lib/troupe/daemon/cli.ex, apps/troupe_daemon/lib/troupe/daemon/application.ex, apps/troupe_daemon/rel/env.bat.eex, apps/troupe_daemon/rel/vm.args.eex, clients/tui/lib/troupe/ui/setup.ex, clients/gui/apps/desktop/src/views/Onboarding/Daemon.tsx