ipn/ipnlocal: return error on missing --unattended on CLI up on Windows

Maybe not the best long-term fix, but better than letting the user
start the server for a millisecond just to have it all torn down as
their CLI command finishes running.

Updates #7055

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2023-02-07 14:35:54 -08:00
parent cab2b2b59e
commit 1502f81974

View File

@ -2498,6 +2498,9 @@ func (b *LocalBackend) checkPrefsLocked(p *ipn.Prefs) error {
if err := b.checkExitNodePrefsLocked(p); err != nil { if err := b.checkExitNodePrefsLocked(p); err != nil {
errs = append(errs, err) errs = append(errs, err)
} }
if runtime.GOOS == "windows" && p.WantRunning && !p.ForceDaemon && len(b.notifyWatchers) == 0 {
errs = append(errs, errors.New("Use 'tailscale up --unattended' on Windows without GUI"))
}
return multierr.New(errs...) return multierr.New(errs...)
} }