We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b2e8284 + 1458000 commit a585107Copy full SHA for a585107
machine.go
@@ -163,6 +163,19 @@ func (m *Machine) Logger() *log.Entry {
163
return m.logger.WithField("subsystem", userAgent)
164
}
165
166
+// PID returns the machine's running process PID or an error if not running
167
+func (m *Machine) PID() (int, error) {
168
+ if m.cmd == nil || m.cmd.Process == nil {
169
+ return 0, fmt.Errorf("machine is not running")
170
+ }
171
+ select {
172
+ case <-m.exitCh:
173
+ return 0, fmt.Errorf("machine process has exited")
174
+ default:
175
176
+ return m.cmd.Process.Pid, nil
177
+}
178
+
179
// NetworkInterface represents a Firecracker microVM's network interface.
180
type NetworkInterface struct {
181
// MacAddress defines the MAC address that should be assigned to the network
0 commit comments