Table of Contents

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

bool

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

(string shell, string argPrefix)

Tuple of shell executable and argument prefix.

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

processName string

Human-readable process name.

PromptForInput(string)

Prompts the user for input in the console.

public static string? PromptForInput(string prompt)

Parameters

prompt string

Prompt 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

prompt string

Prompt 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

prompt string

The 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

prompt string

The 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

prompt string

Prompt 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

arguments string

DotNet command arguments.

processResult Func<int, string, string, bool>

Optional callback receiving (exitCode, stdout, stderr) to determine success.

Returns

Task<bool>

True if command succeeded, otherwise false.

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

command string

Process executable.

arguments string

Arguments for the process.

processResult Func<int, string, string, bool>

Optional callback receiving (exitCode, stdout, stderr) to determine success.

Returns

Task<bool>

True if process succeeded, otherwise false.

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

command string

Process executable.

arguments string

Arguments for the process.

processResult Func<int, string, string, bool>

Optional callback receiving (exitCode, stdout, stderr) to determine success.

Returns

Task<bool>

True if process succeeded, otherwise false.

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

command string

Process executable.

arguments string

Arguments for the process.

stdinText string

Text to write to stdin (followed by EOF).

processResult Func<int, string, string, bool>

Optional callback receiving (exitCode, stdout, stderr).

Returns

Task<bool>

True if process succeeded, otherwise false.

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

shell string

Shell executable.

argPrefix string

Shell argument prefix.

command string

The shell command to execute.

errorMessage string

Error message to log on failure.

Returns

Task<bool>

True if command succeeded, otherwise false.