MCPcopy
hub / github.com/google/gvisor / Execute

Method Execute

runsc/cmd/spec.go:252–275  ·  view source on GitHub ↗

Execute implements subcommands.Command.Execute.

(_ context.Context, f *flag.FlagSet, args ...any)

Source from the content-addressed store, hash-verified

250
251// Execute implements subcommands.Command.Execute.
252func (s *Spec) Execute(_ context.Context, f *flag.FlagSet, args ...any) subcommands.ExitStatus {
253 // Grab the arguments.
254 containerArgs := f.Args()
255 if len(containerArgs) == 0 {
256 containerArgs = []string{"sh"}
257 }
258
259 confPath := filepath.Join(s.bundle, "config.json")
260 if _, err := os.Stat(confPath); !os.IsNotExist(err) {
261 util.Fatalf("file %q already exists", confPath)
262 }
263
264 configFile, err := os.OpenFile(confPath, os.O_WRONLY|os.O_CREATE, 0664)
265 if err != nil {
266 util.Fatalf("opening file %q: %v", confPath, err)
267 }
268
269 err = writeSpec(configFile, s.cwd, s.netns, containerArgs, s.tpu)
270 if err != nil {
271 util.Fatalf("writing to %q: %v", confPath, err)
272 }
273
274 return subcommands.ExitSuccess
275}

Callers

nothing calls this directly

Calls 5

FatalfFunction · 0.92
ArgsMethod · 0.80
writeSpecFunction · 0.70
JoinMethod · 0.65
StatMethod · 0.65

Tested by

no test coverage detected