Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveWorkingDirectory ¶ added in v2.35.0
ResolveWorkingDirectory returns dir when it is non-empty and an existing directory on fs. Otherwise it falls back to the home directory reported by ei. SSH sessions and the process API share this so their working directory resolution cannot drift, and the home fallback goes through the injected EnvInfoer rather than the host directly.
Types ¶
type EnvInfoer ¶ added in v2.21.0
type EnvInfoer interface {
// User returns the current user.
User() (*user.User, error)
// Environ returns the environment variables of the current process.
Environ() []string
// HomeDir returns the home directory of the current user.
HomeDir() (string, error)
// Shell returns the shell of the given user.
Shell(username string) (string, error)
// ModifyCommand modifies the command and arguments before execution based on
// the environment. This is useful for executing a command inside a container.
// In the default case, the command and arguments are returned unchanged.
ModifyCommand(name string, args ...string) (string, []string)
}
EnvInfoer encapsulates external information about the environment.
type SystemEnvInfo ¶ added in v2.21.0
type SystemEnvInfo struct{}
SystemEnvInfo encapsulates the information about the environment just using the default Go implementations.
func (SystemEnvInfo) Environ ¶ added in v2.21.0
func (SystemEnvInfo) Environ() []string
func (SystemEnvInfo) HomeDir ¶ added in v2.21.0
func (SystemEnvInfo) HomeDir() (string, error)
func (SystemEnvInfo) ModifyCommand ¶ added in v2.21.0
func (SystemEnvInfo) ModifyCommand(name string, args ...string) (string, []string)