4
0

executor_windows.go 680 B

1234567891011121314151617181920212223242526272829303132
  1. //go:build windows
  2. // +build windows
  3. package executor
  4. import (
  5. "context"
  6. "os"
  7. "os/exec"
  8. )
  9. func (e *Executor) Kill(execReq *InternalLogEntry) error {
  10. return execReq.Process.Kill()
  11. }
  12. func wrapCommandInShell(ctx context.Context, finalParsedCommand string) *exec.Cmd {
  13. winCodepage := os.Getenv("OT_WIN_FLAG_U")
  14. if winCodepage == "0" {
  15. return exec.CommandContext(ctx, "cmd", "/C", finalParsedCommand)
  16. } else {
  17. return exec.CommandContext(ctx, "cmd", "/u", "/C", finalParsedCommand)
  18. }
  19. }
  20. func wrapCommandDirect(ctx context.Context, execArgs []string) *exec.Cmd {
  21. if len(execArgs) == 0 {
  22. return nil
  23. }
  24. return exec.CommandContext(ctx, execArgs[0], execArgs[1:]...)
  25. }