mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
create, run: amend final errors
As the error may contain anything, it may not be clear to a user that the whole (create or run) operation failed. Amend the errors. Also, change the code flow in create to match that of run, so we don't have to add the fake "return nil" at the end. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
@@ -56,12 +57,11 @@ command(s) that get executed on start, edit the args parameter of the spec. See
|
||||
return err
|
||||
}
|
||||
status, err := startContainer(context, CT_ACT_CREATE, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
if err == nil {
|
||||
// exit with the container's exit status so any external supervisor
|
||||
// is notified of the exit with the correct exit status.
|
||||
os.Exit(status)
|
||||
}
|
||||
// exit with the container's exit status so any external supervisor is
|
||||
// notified of the exit with the correct exit status.
|
||||
os.Exit(status)
|
||||
return nil
|
||||
return fmt.Errorf("runc create failed: %w", err)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
@@ -74,6 +75,6 @@ command(s) that get executed on start, edit the args parameter of the spec. See
|
||||
// notified of the exit with the correct exit status.
|
||||
os.Exit(status)
|
||||
}
|
||||
return err
|
||||
return fmt.Errorf("runc run failed: %w", err)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user