Documentation
¶
Overview ¶
Package instcmd executes the shell session IRIX inst opens over rsh. inst runs "exec /bin/sh" and streams real shell grammar to it - pipes, subshells, trap, $? - so RunShell (shell.go) serves an actual POSIX interpreter wired to a constrained read-only command set rather than pattern-matching the grammar inst is expected to send.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned by a FileSystem for missing paths.
Functions ¶
func RunShell ¶
func RunShell(fsys FileSystem, stdin io.Reader, stdout, stderr io.Writer, logger *logging.Logger, sess *capture.Session) error
RunShell serves the shell inst opens over rsh with "exec /bin/sh": one mvdan/sh Runner for the life of the connection, fed one line at a time so state (variables, traps, $?) persists across lines like a real shell's does. logger records every line at DEBUG, and ERROR/WARN for anything a leaf command refuses or fails (see refusef). A failing command writes its own diagnostic and the shell keeps going, matching inst's expectation that the trailing marker wrapper always still runs.
Types ¶
type FileInfo ¶
type FileInfo struct {
Ino uint64
IsDir bool
Perm uint32 // permission bits incl. setuid/setgid/sticky, e.g. 0o4755
Nlink int
UID uint32
GID uint32
Size int64
Mtime time.Time
}
FileInfo is a path's metadata: what the rsh shell needs to answer ls -l/-i and cd/test's file-type checks, not a full stat(2). A path above the real filesystem's own boundary (a synthetic tree level) carries plausible placeholder values instead of a real inode's.
type FileSystem ¶
type FileSystem interface {
Open(path string) (File, error)
ReadDir(path string) ([]string, error)
Stat(path string) (FileInfo, error)
}
FileSystem is the tree commands read from.
type ImageResolver ¶
ImageResolver is optionally implemented by a FileSystem that can say which image file and in-image path a served path came from, for the steady-state served-file manifest line dd and cat emit at INFO. A FileSystem that doesn't back onto named media (a test double, say) need not implement it; a leaf command that wants it type-asserts and only logs the manifest line when it can.