diff options
| -rw-r--r-- | plugin.go | 2 | ||||
| -rw-r--r-- | pluginCheck.go | 22 |
2 files changed, 16 insertions, 8 deletions
@@ -257,7 +257,7 @@ func searchPaths(name string) *aplug { func initToolkit(name string, filename string) *aplug { // smart plugin test. remove all other code besides this if err := checkPluginViaSubprocess(filename); err != nil { - log.Printf("initToolkit() subprocess load plugin failed: %v\n", err) + // log.Printf("initToolkit() subprocess load plugin failed: %v\n", err) return nil } // the plugin will probably work. show the banner diff --git a/pluginCheck.go b/pluginCheck.go index 15f6660..8d60419 100644 --- a/pluginCheck.go +++ b/pluginCheck.go @@ -19,7 +19,7 @@ import ( func checkPluginCompatibility(pluginPath string) error { pluginInfo, err := buildinfo.ReadFile(pluginPath) if err != nil { - return log.Errorf("failed to read plugin build info: %w", err) + return err } mainInfo, ok := debug.ReadBuildInfo() @@ -33,7 +33,7 @@ func checkPluginCompatibility(pluginPath string) error { return log.Errorf("Go version mismatch: plugin=%s, host=%s", pluginInfo.GoVersion, mainInfo.GoVersion) } - log.Info("CHECK OK: binary build info:", pluginPath) + // log.Info("CHECK OK: binary build info:", pluginPath) // Create a map of main binary dependencies for quick lookup hostDeps := make(map[string]string) @@ -41,7 +41,7 @@ func checkPluginCompatibility(pluginPath string) error { hostDeps[dep.Path] = dep.Version } - log.Info("CHECK OK: binary build info:", hostDeps) + // log.Info("CHECK OK: binary build info:", hostDeps) // Compare plugin dependencies for _, dep := range pluginInfo.Deps { @@ -77,7 +77,7 @@ func TestPluginAndExit() { } func TestPluginAndExitNew(hackname string) { - log.Log(WARN, "TEST plugin START", hackname) + // log.Log(WARN, "TEST plugin START", hackname) absPath, err := filepath.Abs(hackname) if err != nil { @@ -85,10 +85,14 @@ func TestPluginAndExitNew(hackname string) { os.Exit(-1) } - log.Log(WARN, "TEST plugin START abs:", absPath, hackname) + // log.Log(WARN, "TEST plugin START abs:", absPath, hackname) plug, err := checkPlug(absPath) if plug == nil { - log.Log(WARN, "TEST plugin failed (returned nil):", hackname, absPath, err) + if errors.Is(err, os.ErrNotExist) { + // don't print anything if file does not exist + os.Exit(-1) + } + // log.Log(WARN, "TEST plugin failed (returned nil):", hackname, absPath, err) os.Exit(-1) } if err == nil { @@ -111,7 +115,7 @@ func checkPluginViaSubprocess(path string) error { } argv := []string{resolved, "--gui-check-plugin", path} - log.Warn("RUNNING:", argv) + // log.Warn("RUNNING:", argv) cmd := exec.Command(argv[0], argv[1:]...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr @@ -134,6 +138,10 @@ func checkPlug(pluginPath string) (*plugin.Plugin, error) { // /usr/lib/go-gui-toolkits/gocui.v0.22.46.so if err := checkPluginCompatibility(pluginPath); err != nil { + if errors.Is(err, os.ErrNotExist) { + // don't print any output if it's only that the file is missing + return nil, err + } log.Printf("Plugin check failed: %v\n", err) return nil, err } |
