Documentation
¶
Index ¶
- Variables
- func GenerateUsageHint(userShell, cmdLine string) string
- func GenerateUsageHintWithComment(userShell, cmdLine string) string
- func GetEnvString(userShell string, envName string, envValue string) string
- func GetPathEnvString(userShell string, prependedPath string) string
- func GetShell(userShell string) (string, error)
- func IsWindowsSubsystemLinux() bool
- type AbstractProcess
- type Config
- type RealProcess
Constants ¶
This section is empty.
Variables ¶
var ( CommandRunner = crcos.NewLocalCommandRunner() WindowsSubsystemLinuxKernelMetadataFile = "/proc/version" ErrUnknownShell = errors.New("Error: Unknown shell") )
Functions ¶
func GenerateUsageHint ¶
func GetPathEnvString ¶
func IsWindowsSubsystemLinux ¶ added in v2.46.0
func IsWindowsSubsystemLinux() bool
IsWindowsSubsystemLinux detects whether current system is using Windows Subsystem for Linux or not
It checks for these conditions to make sure that current system has WSL installed: - `/proc/version` file is present - `/proc/version` file contents contain keywords `Microsoft` and `WSL`
It above conditions are met, then this method returns `true` otherwise `false`.
Types ¶
type AbstractProcess ¶ added in v2.47.0
type AbstractProcess interface { Name() (string, error) Parent() (AbstractProcess, error) }
AbstractProcess is an interface created to abstract operations of the gopsutil library It is created so that we can override the behavior while writing unit tests by providing a mock implementation.
type RealProcess ¶ added in v2.47.0
RealProcess is a wrapper implementation of AbstractProcess to wrap around the gopsutil library's process.Process object. This implementation is used in production code.
func (*RealProcess) Parent ¶ added in v2.47.0
func (p *RealProcess) Parent() (AbstractProcess, error)