AirVPN / Eddie

UI/CLI for OpenVPN/WireGuard
https://eddie.website
GNU General Public License v3.0
353 stars 77 forks source link

Eddie can't handle being run as a tty-less service #134

Open buddyabaddon opened 5 months ago

buddyabaddon commented 5 months ago

In an attempt to run Eddie as a Systemd service, I find the eddie-cli internally relies on Console.ReadKey(). This results in the following being logged multiple times per second, rendering the stdout logging pretty useless:

Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.

It seems Console.ReadKey() doesn't play well with redirected stdin/out.

Example Systemd service:

[Unit]
Description = AirVPN Client (Eddie)
After = network.target

[Service]
Type = exec
User = root
WorkingDirectory = /root/.config/eddie
ExecStart = /usr/bin/eddie-cli
Restart = always

[Install]
WantedBy = multi-user.target

Example Systemd journal as a result:

Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:25 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:26 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Apr 19 17:49:27 redacted eddie-cli[1234]: Console error: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.