MCPcopy
hub / github.com/micro-editor/micro / RunBackgroundShell

Function RunBackgroundShell

internal/shell/shell.go:51–69  ·  view source on GitHub ↗

RunBackgroundShell runs a shell command in the background It returns a function which will run the command and returns a string message result

(input string)

Source from the content-addressed store, hash-verified

49// It returns a function which will run the command and returns a string
50// message result
51func RunBackgroundShell(input string) (func() string, error) {
52 args, err := shellquote.Split(input)
53 if err != nil {
54 return nil, err
55 }
56 if len(args) == 0 {
57 return nil, errors.New("No arguments")
58 }
59 inputCmd := args[0]
60 return func() string {
61 output, err := RunCommand(input)
62
63 str := output
64 if err != nil {
65 str = fmt.Sprint(inputCmd, " exited with error: ", err, ": ", output)
66 }
67 return str
68 }, nil
69}
70
71// RunInteractiveShell runs a shellcommand interactively
72func RunInteractiveShell(input string, wait bool, getOutput bool) (string, error) {

Callers 1

RunCmdMethod · 0.92

Calls 1

RunCommandFunction · 0.85

Tested by

no test coverage detected