Skip to content

Commit

Permalink
Set headless mode automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Aug 20, 2024
1 parent 4ce42e3 commit 1c4813d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Cmdline/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ public virtual int Handle(GameInstanceManager manager, IUser user)
log.Info("Verbose logging enabled");
}

// Auto-detect whether IO device is interactive
if (!Headless && (Console.IsInputRedirected || Console.IsOutputRedirected))
{
log.InfoFormat("Setting headless mode ({0})",
Console.IsInputRedirected
? Console.IsOutputRedirected
? "I/O redirected"
: "input redirected"
: "output redirected");
Headless = true;
}

// Assign user-agent string if user has given us one
if (NetUserAgent != null)
{
Expand Down

0 comments on commit 1c4813d

Please sign in to comment.