Skip to content
Snippets Groups Projects
Commit 189999f1 authored by kaiyou's avatar kaiyou
Browse files

Special argv-based hooks are not needed anymore

parent 7efd137d
No related branches found
No related tags found
No related merge requests found
...@@ -11,22 +11,8 @@ import ( ...@@ -11,22 +11,8 @@ import (
func main() { func main() {
fn := hepto.Hepto fn := hepto.Hepto
program := filepath.Base(os.Args[0]) program := filepath.Base(os.Args[0])
hook, ok := hepto.Hooks[program] if hook, ok := hepto.Hooks[program]; ok {
switch {
case ok:
fn = hook fn = hook
case len(os.Args) <= 1:
break
// Containerd is often called back, especially by runc shim
// to communicate about the shim status, except it gets its own
// name from `os.Executable`, which returns `hepto` and does not
// call into `containerd`. Thus, we match on very specific command
// line arguments to guess whether this is a callback to containerd
case os.Args[1] == "publish":
fn = hepto.Containerd
// Same behavior for the shim itself
case os.Args[1] == "-namespace":
fn = hepto.Shim
} }
err := fn() err := fn()
if err != nil { if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment