func Command(command ...string) *exec.Cmd {
	name, arg := commandParts(command...)
	return exec.Command(name, arg...)
}
Command returns a Cmd from a shell command.
package exec
import (
	"bytes"
	"context"
	"io"
	"os/exec"
	"runtime"
	"strings"
	"syscall"
	"time"
)
type CommandExecutor struct {
	Done chan error
	done chan error
	pipe *io.PipeReader
}
func (c *CommandExecutor) Read(p []byte) (int, error) {
	return c.pipe.Read(p)
}
func Run(ctx context.Context, command string, arg []string) (*CommandExecutor, error) {
	if ctx == nil {
		ctx = context.Background()
	}
	if runtime.GOOS == "windows" {
		if len(arg) == 1 && strings.HasSuffix(arg[0], ".ps1") {
			arg = append([]string{"-File"}, arg...)
		}
	}
	commandExecutor := &CommandExecutor{Done: make(chan error, 1), done: make(chan error, 1)}
	cmd := exec.CommandContext(ctx, command, arg...)
	go func() {
		var err error
		defer func() { commandExecutor.Done <- err }()
		select {
		case <-ctx.Done():
			err = ctx.Err()
		case err = <-commandExecutor.done:
		}
	}()
	r, w := io.Pipe()
	cmd.Stdout = w
	cmd.Stderr = w
	commandExecutor.pipe = r
	go func() {
		defer w.Close()
		commandExecutor.done <- cmd.Run()
	}()
	return commandExecutor, nil
}
func commandParts(command ...string) (name string, arg []string) {
	if len(command) == 0 {
		panic("empty command")
	}
	return command[0], command[1:]
}