otel-cli icon indicating copy to clipboard operation
otel-cli copied to clipboard

Segfault when trying to exec a non-existent path

Open shastah opened this issue 1 year ago • 0 comments

When using exec <path> otel-cli segfaults if <path> doesn't exist:

$ otel-cli exec /bin/foobar
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104dfc6f4]

goroutine 1 [running]:
github.com/equinix-labs/otel-cli/otelcli.doExec(0x14000224f00?, {0x140002a6ab0, 0x1, 0x1})
	/home/atobey/src/otel-cli/otelcli/exec.go:149 +0xd54
github.com/spf13/cobra.(*Command).execute(0x140002d2600, {0x140002a6a80, 0x1, 0x1})
	/home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0x814
github.com/spf13/cobra.(*Command).ExecuteC(0x1400022d500)
	/home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
	/home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:1032
github.com/equinix-labs/otel-cli/otelcli.Execute({0x1400026c2d0, 0x43})
	/home/atobey/src/otel-cli/otelcli/root.go:89 +0x138
main.main()
	/home/atobey/src/otel-cli/main.go:17 +0x50

I'm running 0.4.5.

shastah avatar Aug 12 '24 23:08 shastah