Documentation
¶
Overview ¶
Package installchange tells a running pig that the files it runs from changed on disk.
Pi (packages/coding-agent/src/config.ts detectInstallChange, #10439) warns when an update or removal replaced the package its process loads code from. PiG is one native executable that embeds its code, so the same hazard comes from other files: an update replaces or removes the executable, and another pig's cache prune removes an extension cell or runtime file this process still starts on demand.
pig additive (D95): there is no upstream equivalent of tracking an executable and cache files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileID ¶
FileID is a file's device and inode on Unix, or its volume serial number and file index on Windows.
type Identity ¶
type Identity struct {
// Path is the path with its symbolic links resolved.
Path string
File FileID
Size int64
ModTime time.Time
}
Identity is what a path named when it was recorded.
type Kind ¶
type Kind string
Kind classifies a change.
const ( // BinaryReplaced means the executable at the recorded path is another file now. BinaryReplaced Kind = "binary-replaced" // BinaryRemoved means the executable is gone. BinaryRemoved Kind = "binary-removed" // FilesPruned means an extension cell or runtime file this process uses is gone. FilesPruned Kind = "files-pruned" )
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker holds what one process recorded at startup.
func Default ¶
func Default() *Tracker
Default returns the tracker Record made, or nil before Record.
func NewTracker ¶
NewTracker records executable's identity, or this process's executable (linkerexec.Executable, which knows a program started through the Android linker) when executable is empty. An executable that cannot be read at startup is not tracked, because there is nothing to compare it with.
func (*Tracker) Detect ¶
Detect reports the first change since startup, or nil. Ports packages/coding-agent/src/config.ts (detectInstallChange).
It checks the recorded paths and never searches for another install, so an install removed from under the process is reported as removed even when another executable of the same name sits further up the tree, as Pi reads the package.json it started from. Only a missing file counts: an error such as a permission failure says nothing about the install.
func (*Tracker) Executable ¶
Executable returns what was recorded for the executable.
func (*Tracker) TrackFile ¶
TrackFile records a cell or runtime file this process uses, so a later Detect notices that it is gone. A repeated path is recorded once.
func (*Tracker) TrackedFiles ¶
TrackedFiles returns the recorded cell and runtime files in the order they were recorded.