mirror of
https://github.com/IBM/fp-go.git
synced 2025-11-25 22:21:49 +02:00
17 lines
405 B
Go
17 lines
405 B
Go
|
|
package generic
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
ET "github.com/ibm/fp-go/either"
|
||
|
|
"github.com/ibm/fp-go/exec"
|
||
|
|
GE "github.com/ibm/fp-go/internal/exec"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Command executes a command
|
||
|
|
func Command[GA ~func() ET.Either[error, exec.CommandOutput]](name string, args []string, in []byte) GA {
|
||
|
|
return TryCatchError[GA](func() (exec.CommandOutput, error) {
|
||
|
|
return GE.Exec(context.Background(), name, args, in)
|
||
|
|
})
|
||
|
|
}
|