mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Correct use of reexec.Init()
A true result from reexec.Init() isn't an error, but it indicates that main() should exit with a success exit status. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
@ -149,6 +149,8 @@ func main() {
|
|||||||
//cpuProfile := false
|
//cpuProfile := false
|
||||||
|
|
||||||
if reexec.Init() {
|
if reexec.Init() {
|
||||||
|
// We were invoked with a different argv[0] indicating that we
|
||||||
|
// had a specific job to do as a subprocess, and it's done.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Hard code TMPDIR functions to use /var/tmp, if user did not override
|
// Hard code TMPDIR functions to use /var/tmp, if user did not override
|
||||||
|
@ -36,6 +36,9 @@ var helpMessage = `
|
|||||||
`
|
`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if reexec.Init() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
imageName := ""
|
imageName := ""
|
||||||
@ -51,10 +54,6 @@ func main() {
|
|||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if reexec.Init() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
switch strings.ToLower(*logLevel) {
|
switch strings.ToLower(*logLevel) {
|
||||||
case "error":
|
case "error":
|
||||||
logrus.SetLevel(logrus.ErrorLevel)
|
logrus.SetLevel(logrus.ErrorLevel)
|
||||||
|
@ -29,7 +29,6 @@ import (
|
|||||||
"github.com/containers/libpod/pkg/registries"
|
"github.com/containers/libpod/pkg/registries"
|
||||||
"github.com/containers/libpod/pkg/util"
|
"github.com/containers/libpod/pkg/util"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/containers/storage/pkg/reexec"
|
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@ -85,9 +84,6 @@ func NewImageRuntimeFromStore(store storage.Store) *Runtime {
|
|||||||
// NewImageRuntimeFromOptions creates an Image Runtime including the store given
|
// NewImageRuntimeFromOptions creates an Image Runtime including the store given
|
||||||
// store options
|
// store options
|
||||||
func NewImageRuntimeFromOptions(options storage.StoreOptions) (*Runtime, error) {
|
func NewImageRuntimeFromOptions(options storage.StoreOptions) (*Runtime, error) {
|
||||||
if reexec.Init() {
|
|
||||||
return nil, errors.Errorf("unable to reexec")
|
|
||||||
}
|
|
||||||
store, err := setStore(options)
|
store, err := setStore(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/containers/libpod/libpod/events"
|
"github.com/containers/libpod/libpod/events"
|
||||||
"github.com/containers/libpod/pkg/util"
|
"github.com/containers/libpod/pkg/util"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
|
"github.com/containers/storage/pkg/reexec"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@ -70,6 +71,13 @@ func makeLocalMatrix(b, bg *Image) ([]localImageTest, error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
if reexec.Init() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
os.Exit(m.Run())
|
||||||
|
}
|
||||||
|
|
||||||
// TestImage_NewFromLocal tests finding the image locally by various names,
|
// TestImage_NewFromLocal tests finding the image locally by various names,
|
||||||
// tags, and aliases
|
// tags, and aliases
|
||||||
func TestImage_NewFromLocal(t *testing.T) {
|
func TestImage_NewFromLocal(t *testing.T) {
|
||||||
|
@ -78,11 +78,15 @@ func (a testResultsSorted) Less(i, j int) bool { return a[i].length < a[j].lengt
|
|||||||
|
|
||||||
var testResults []testResult
|
var testResults []testResult
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
if reexec.Init() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
os.Exit(m.Run())
|
||||||
|
}
|
||||||
|
|
||||||
// TestLibpod ginkgo master function
|
// TestLibpod ginkgo master function
|
||||||
func TestLibpod(t *testing.T) {
|
func TestLibpod(t *testing.T) {
|
||||||
if reexec.Init() {
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
if os.Getenv("NOCACHE") == "1" {
|
if os.Getenv("NOCACHE") == "1" {
|
||||||
CACHE_IMAGES = []string{}
|
CACHE_IMAGES = []string{}
|
||||||
RESTORE_IMAGES = []string{}
|
RESTORE_IMAGES = []string{}
|
||||||
|
Reference in New Issue
Block a user