Browse Source

fix: processes manager error messages

Yeuoly 10 months ago
parent
commit
6920804382

+ 3 - 1
cmd/commandline/plugin.go

@@ -149,7 +149,7 @@ endpoint				- allow plugin to register endpoint`,
 	}
 
 	pluginTestCommand = &cobra.Command{
-		Use:   "test package_path invoke_type invoke_action [-i inputs] [-t timeout]",
+		Use:   "test [-i inputs] [-t timeout] package_path invoke_type invoke_action",
 		Short: "",
 		Long: "Test runs the given plugin package locally, and you can specify the inputs using json format, if not specified, will use default inputs\n" +
 			"type: invoke type, available values: \n" +
@@ -252,6 +252,8 @@ func init() {
 	pluginCommand.AddCommand(pluginChecksumCommand)
 	pluginCommand.AddCommand(pluginPermissionCommand)
 	pluginCommand.AddCommand(pluginTestCommand)
+	pluginTestCommand.Flags().StringP("inputs", "i", "", "inputs")
+	pluginTestCommand.Flags().StringP("timeout", "t", "", "timeout")
 	pluginPermissionCommand.AddCommand(pluginPermissionAddCommand)
 	pluginPermissionCommand.AddCommand(pluginPermissionDropCommand)
 }

+ 2 - 1
internal/core/plugin_manager/manager.go

@@ -3,6 +3,7 @@ package plugin_manager
 import (
 	"fmt"
 	"os"
+	"path/filepath"
 
 	"github.com/langgenius/dify-plugin-daemon/internal/core/dify_invocation"
 	"github.com/langgenius/dify-plugin-daemon/internal/core/dify_invocation/real"
@@ -69,7 +70,7 @@ func NewManager(configuration *app.Config) *PluginManager {
 	os.MkdirAll(configuration.PluginWorkingPath, 0755)
 	os.MkdirAll(configuration.PluginStoragePath, 0755)
 	os.MkdirAll(configuration.PluginMediaCachePath, 0755)
-	os.MkdirAll(configuration.ProcessCachingPath, 0755)
+	os.MkdirAll(filepath.Dir(configuration.ProcessCachingPath), 0755)
 
 	return manager
 }

+ 2 - 1
internal/process/manager.go

@@ -7,6 +7,7 @@ import (
 	"os/signal"
 	"path"
 	"strconv"
+	"strings"
 	"sync"
 	"syscall"
 
@@ -32,7 +33,7 @@ func subprocesses() []int {
 
 	data, err := os.ReadFile(subprocess_path)
 	if err != nil {
-		if err != os.ErrNotExist {
+		if !strings.Contains(err.Error(), "no such file or directory") {
 			log.Error("Error reading subprocesses file")
 		}
 		return []int{}