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)
| 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. |
| 391 | func 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 | |
| 416 | func terminateStartedCommand(cmd *exec.Cmd) { |
| 417 | cleanupPendingPlatformResources(cmd) |
no test coverage detected