MCPcopy
hub / github.com/sipeed/picoclaw / Run

Function Run

pkg/isolation/runtime.go:391–414  ·  view source on GitHub ↗

Run is the Start-and-Wait helper that keeps the same isolation behavior as Start while returning the command's final exit status.

(cmd *exec.Cmd)

Source from the content-addressed store, hash-verified

389// Run is the Start-and-Wait helper that keeps the same isolation behavior as
390// Start while returning the command's final exit status.
391func Run(cmd *exec.Cmd) error {
392 if err := PrepareCommand(cmd); err != nil {
393 return err
394 }
395 if err := cmd.Start(); err != nil {
396 cleanupPendingPlatformResources(cmd)
397 return err
398 }
399 isolation := CurrentConfig()
400 root := ""
401 if isolation.Enabled {
402 var err error
403 root, err = ResolveInstanceRoot()
404 if err != nil {
405 terminateStartedCommand(cmd)
406 return err
407 }
408 }
409 if err := postStartPlatformIsolation(cmd, isolation, root); err != nil {
410 terminateStartedCommand(cmd)
411 return err
412 }
413 return cmd.Wait()
414}
415
416func terminateStartedCommand(cmd *exec.Cmd) {
417 cleanupPendingPlatformResources(cmd)

Callers 2

ChatMethod · 0.92
ChatMethod · 0.92

Calls 8

PrepareCommandFunction · 0.85
CurrentConfigFunction · 0.85
ResolveInstanceRootFunction · 0.85
terminateStartedCommandFunction · 0.85
StartMethod · 0.65
WaitMethod · 0.45

Tested by

no test coverage detected