diff options
| author | Jeff Carr <[email protected]> | 2025-10-04 02:07:38 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-04 02:07:38 -0500 | 
| commit | e2310a4fce5f52fe32537e04aa6652402b5b9b4a (patch) | |
| tree | 35d727c4aa30615ab2caf80aeda2319e83fb3863 | |
| parent | 913247c7578e8539a12fd7447d1b8e5826884b90 (diff) | |
| -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  	}  | 
