{"modulePath":"github.com/devsy-org/devsy","version":"v1.27.1","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package command\n\n## Functions\n\n```go\nfunc CleanupUnpublishedLaunch(path, _ string, _ bool) error\n```\nCleanupUnpublishedLaunch cannot signal an unidentified process. An available lifetime lease proves neither the launcher nor its bootstrap child remains.\n\n```go\nfunc Exists(cmd string) bool\n```\n\n```go\nfunc ExistsForUser(cmd, user string) bool\n```\n\n```go\nfunc ForUser(cmd *exec.Cmd, userName string) error\n```\n\n```go\nfunc GetHome(userName string) (string, error)\n```\n\n```go\nfunc IsRunning(pid string) (bool, error)\n```\n\n```go\nfunc Kill(pid string) error\n```\n\n```go\nfunc KillTree(pid, treeName string) error\n```\nKillTree terminates the process and everything it spawned: the job or process group treeName identifies when set, otherwise the process alone.\n\n```go\nfunc KillTreeAfterWorkerExit(pid, treeName, identity string) error\n```\nKillTreeAfterWorkerExit terminates descendants using the worker's saved session identity.\n\n```go\nfunc KillTreeWithIdentity(pid, treeName, identity string) error\n```\nKillTreeWithIdentity terminates a worker tree using its saved platform identity.\n\n```go\nfunc MarkInheritedFDsCloseOnExec()\n```\n\n```go\nfunc ProcessExited(ref ProcessRef) (bool, error)\n```\nProcessExited reports positive evidence that the saved worker has exited. Identityless records cannot distinguish a worker from a reused PID.\n\n```go\nfunc ProcessTreeIdentity(pid int) (string, error)\n```\nProcessTreeIdentity returns the kernel identity used to distinguish a reused process ID.\n\n```go\nfunc Quote(args []string) string\n```\n\n```go\nfunc RetainLaunchLease() error\n```\nRetainLaunchLease keeps the inherited claim until process exit, without passing it on to commands the worker executes.\n\n```go\nfunc StartBackground(commandName string, createCommand CreateCommand) error\n```\nStartBackground starts a background process unconditionally, without any once-guard. Use this for commands that must run on every invocation (e.g. postAttachCommand which runs on every attach per the devcontainer spec).\n\n```go\nfunc StartBackgroundOnce(commandName string, createCommand CreateCommand) error\n```\nStartBackgroundOnce starts a background process, ensuring only one instance with the given commandName runs at a time. If a process is already running (determined by PID file), or the lock cannot be acquired, it returns nil.\n\nProcess output is redirected to TMPDIR/commandName.streams unless the command already has Stdout/Stderr configured. The PID is recorded in TMPDIR/commandName.pid. These files are not cleaned up on exit.\n\n```go\nfunc StartSupervisedBackground(opts SupervisedStartOptions, createCommand CreateCommand) error\n```\nStartSupervisedBackground starts a detached worker with an owned process tree and publishes its reference before the launch is considered complete.\n\n```go\nfunc StartedSessionIdentity(pid int) (string, error)\n```\nStartedSessionIdentity captures a child's tree identity before its parent reaps it. The caller must have started the child with Setsid enabled.\n\n```go\nfunc WrapCommandError(stdout []byte, err error) error\n```\n\n## Types\n\n```go\ntype CreateCommand func() (*exec.Cmd, error)\n```\n\n```go\ntype Error struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (e *Error) Error() string\n```\n\n```go\nfunc (e *Error) Unwrap() error\n```\n\n```go\ntype LaunchLease struct {\n\t// contains filtered or unexported fields\n}\n```\nLaunchLease survives launcher death until the worker exits, including the interval before its process reference has been published.\n\n```go\nfunc NewLaunchLease(path string) (*LaunchLease, error)\n```\n\n```go\nfunc (l *LaunchLease) Close() error\n```\n\n```go\ntype ProcessController interface {\n\tTerminate(ProcessRef) error\n\tCleanupAfterExit(ProcessRef) error\n}\n```\nProcessController provides the two operations needed by task cancellation.\n\n```go\nfunc DefaultProcessController() ProcessController\n```\n\n```go\ntype ProcessRef struct {\n\tPID      int             `json:\"pid,omitempty\"`\n\tTreeKind ProcessTreeKind `json:\"treeKind,omitempty\"`\n\tTreeID   string          `json:\"treeId,omitempty\"`\n\tIdentity string          `json:\"identity,omitempty\"`\n}\n```\nProcessRef is the persisted reference used to supervise a detached worker. TreeID and Identity are opaque outside this package.\n\n```go\ntype ProcessTreeKind string\n```\nProcessTreeKind identifies the platform primitive that owns a worker tree.\n\n```go\nconst (\n\tProcessTreeLegacyPID  ProcessTreeKind = \"legacy-pid\"\n\tProcessTreeUnixGroup  ProcessTreeKind = \"unix-group-v1\"\n\tProcessTreeWindowsJob ProcessTreeKind = \"windows-job-v1\"\n)\n```\n\n```go\ntype SupervisedStartOptions struct {\n\tName            string\n\tOnStarted       func(ProcessRef) error\n\tLease           *LaunchLease\n\tAtomicOwnership bool\n\tOnPrepared      func(string) error\n}\n```\n\n","path":"github.com/devsy-org/devsy/pkg/command","name":"command","synopsis":"","isRedistributable":true}
