func main() { cmd.ExecInCoreSnap() // magic \o/ snapApp := filepath.Base(os.Args[0]) if osutil.IsSymlink(filepath.Join(dirs.SnapBinariesDir, snapApp)) { cmd := &cmdRun{} args := []string{snapApp} args = append(args, os.Args[1:]...) // this will call syscall.Exec() so it does not return // *unless* there is an error, i.e. we setup a wrong // symlink (or syscall.Exec() fails for strange reasons) err := cmd.Execute(args) fmt.Fprintf(Stderr, i18n.G("internal error, please report: running %q failed: %v\n"), snapApp, err) os.Exit(46) } defer func() { if v := recover(); v != nil { if e, ok := v.(*exitStatus); ok { os.Exit(e.code) } panic(v) } }() // no magic /o\ if err := run(); err != nil { fmt.Fprintf(Stderr, i18n.G("error: %v\n"), err) os.Exit(1) } }
func main() { cmd.ExecInCoreSnap() if err := run(); err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) os.Exit(1) } }