Skip to content

Commit

Permalink
Merge #4166 Set headless mode automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Aug 20, 2024
2 parents 2d29d21 + 1c4813d commit 9007b20
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
env:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
if: env.REPO_ACCESS_TOKEN
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
repository: KSP-CKAN/CKAN-ModInstaller
event-type: deploy
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ All notable changes to this project will be documented in this file.
- [CLI] Make `ckan compat add` take multiple versions, add `clear` and `set` (#4151 by: HebaruSan)
- [GUI] Add mod support links to Help menu (#4154 by: HebaruSan)
- [GUI] Don't hide other providing mods for installed, make installed bold (#4163 by: HebaruSan)
- [CLI] Set headless mode automatically (#4166 by: HebaruSan)

### Bugfixes

Expand Down
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 9007b20

Please sign in to comment.