Class InstallerProcessHelper
- Namespace
- FishMMO.Installer
- Assembly
- FishMMO-Installer.dll
Provides shared process execution, console prompting, and Linux DotNet environment bootstrapping used by installer classes.
public static class InstallerProcessHelper
- Inheritance
-
InstallerProcessHelper
- Inherited Members
Fields
AcceptDefaults
When true, PromptForYesNo(string) returns the default answer without
displaying a prompt. Set via --accept-defaults / -y.
public static bool AcceptDefaults
Field Value
Methods
EnsureDotNetEnvironment()
Ensures Linux DotNet runtime/tooling environment variables are configured once per process. Adds ~/.dotnet and ~/.dotnet/tools to PATH when missing and sets DOTNET_ROOT.
public static void EnsureDotNetEnvironment()
GetShellCommand()
Gets the appropriate shell command and argument prefix for the current OS. Windows returns cmd.exe /c. Linux prefers fish (-lc) when available, otherwise /bin/bash -c.
public static (string shell, string argPrefix) GetShellCommand()
Returns
GetWorkingDirectory()
Gets the working directory for the current application domain.
public static string GetWorkingDirectory()
Returns
- string
Base directory path.
LogElevatedProcessEnvironmentWarning(string)
Logs a warning that elevated Windows processes may not inherit all per-process environment overrides.
public static void LogElevatedProcessEnvironmentWarning(string processName)
Parameters
processNamestringHuman-readable process name.
PromptForInput(string)
Prompts the user for input in the console.
public static string? PromptForInput(string prompt)
Parameters
promptstringPrompt message.
Returns
- string
User input string.
PromptForPassword(string)
Prompts the user for a password in the console, masking input with asterisks.
public static string PromptForPassword(string prompt)
Parameters
promptstringPrompt message.
Returns
- string
Password string.
PromptForRequiredInput(string)
Prompts for required input. Loops until a non-empty value is entered. Pressing Enter with no input re-prompts.
public static string PromptForRequiredInput(string prompt)
Parameters
promptstringThe prompt text.
Returns
- string
A non-empty input string.
PromptForRequiredPassword(string)
Prompts for a required password. Loops until a non-empty value is entered. Pressing Enter with no input re-prompts.
public static string PromptForRequiredPassword(string prompt)
Parameters
promptstringThe prompt text.
Returns
- string
A non-empty password string.
PromptForYesNo(string)
Prompts the user for a yes/no response in the console.
public static bool PromptForYesNo(string prompt)
Parameters
promptstringPrompt message.
Returns
- bool
True for yes, false for no.
RunDotNetProcessAsync(string, Func<int, string, string, bool>?)
Runs a DotNet command after preparing Linux DotNet environment variables.
public static Task<bool> RunDotNetProcessAsync(string arguments, Func<int, string, string, bool>? processResult = null)
Parameters
argumentsstringDotNet command arguments.
processResultFunc<int, string, string, bool>Optional callback receiving (exitCode, stdout, stderr) to determine success.
Returns
RunProcessAsync(string, string, Func<int, string, string, bool>?)
Runs a process asynchronously and returns true if successful.
public static Task<bool> RunProcessAsync(string command, string arguments, Func<int, string, string, bool>? processResult = null)
Parameters
commandstringProcess executable.
argumentsstringArguments for the process.
processResultFunc<int, string, string, bool>Optional callback receiving (exitCode, stdout, stderr) to determine success.
Returns
RunProcessWithLiveOutputAsync(string, string, Func<int, string, string, bool>?)
Runs a process asynchronously, streaming stdout and stderr to the console in real-time while also capturing the full output. Use this for long-running processes where the user needs to see progress (e.g., win-acme, certbot).
public static Task<bool> RunProcessWithLiveOutputAsync(string command, string arguments, Func<int, string, string, bool>? processResult = null)
Parameters
commandstringProcess executable.
argumentsstringArguments for the process.
processResultFunc<int, string, string, bool>Optional callback receiving (exitCode, stdout, stderr) to determine success.
Returns
RunProcessWithStdinAsync(string, string, string, Func<int, string, string, bool>?)
Runs a process asynchronously, writing the supplied text to the
process's standard input before closing it. Used to deliver
secrets (e.g. passwords for psql meta-commands) without
exposing them on the process command line or in shell history.
public static Task<bool> RunProcessWithStdinAsync(string command, string arguments, string stdinText, Func<int, string, string, bool>? processResult = null)
Parameters
commandstringProcess executable.
argumentsstringArguments for the process.
stdinTextstringText to write to stdin (followed by EOF).
processResultFunc<int, string, string, bool>Optional callback receiving (exitCode, stdout, stderr).
Returns
RunShellCommandAsync(string, string, string, string)
Runs a shell command using the OS-appropriate shell and logs errors on failure.
public static Task<bool> RunShellCommandAsync(string shell, string argPrefix, string command, string errorMessage)
Parameters
shellstringShell executable.
argPrefixstringShell argument prefix.
commandstringThe shell command to execute.
errorMessagestringError message to log on failure.