fix(extension): extension process control lifecycle by self

This commit is contained in:
iyear 2024-11-22 15:45:02 +08:00
parent c19fb820d2
commit 0d574733f2
2 changed files with 3 additions and 3 deletions

View File

@ -132,7 +132,7 @@ func NewExtensionCmd(em *extensions.Manager, ext extensions.Extension, stdin io.
Debug: viper.GetBool(consts.FlagDebug),
}
if err = em.Dispatch(ctx, ext, args, env, stdin, stdout, stderr); err != nil {
if err = em.Dispatch(ext, args, env, stdin, stdout, stderr); err != nil {
var execError *exec.ExitError
if errors.As(err, &execError) {
return execError

View File

@ -64,8 +64,8 @@ func (m *Manager) SetClient(client *http.Client) {
m.github = newGhClient(client)
}
func (m *Manager) Dispatch(ctx context.Context, ext Extension, args []string, env *extension.Env, stdin io.Reader, stdout, stderr io.Writer) (rerr error) {
cmd := exec.CommandContext(ctx, ext.Path(), args...)
func (m *Manager) Dispatch(ext Extension, args []string, env *extension.Env, stdin io.Reader, stdout, stderr io.Writer) (rerr error) {
cmd := exec.Command(ext.Path(), args...)
envFile, err := os.CreateTemp("", "*")
if err != nil {