<commit_before>package quantum

import (
	"fmt"
	"os"
	"os/exec"
	"runtime"
	"sync"
	"syscall"

	"github.com/mitchellh/iochan"
)

// Runner defines an interface for running commands
type Runner interface {
	Run(string, chan<- string, <-chan os.Signal) error
}

/*
// BasicRun is a basic way to run jobs. It takes care of creating the necessary
// dependencies and making them available to the statebag. It also checks for the
// statebags error.
func BasicRun(job BasicJob, conn AgentConn) error {

}
*/

// NewBasicRunner returns a basic runner
func NewBasicRunner() (r Runner) {
	return &BasicRunner{}
}

// BasicRunner is a basic implementation of Runner
type BasicRunner struct{}

// Run runs a command and captures the output of the command, while listening
// for and sending signals to the process.
func (r *BasicRunner) Run(cmd string,
	outCh chan<- string,
	sigCh <-chan os.Signal) error {
	var shell, flag string
	if runtime.GOOS == "windows" {
		shell = "cmd"
		flag = "/C"
	} else {
		shell = "/bin/bash"
		flag = "-c"
	}
	// Tell the client what we're running.
	// Note: the tests expect this
	outCh <- "Running " + cmd + "\n"
	ec := exec.Command(shell, flag, cmd)
	return run(ec, outCh, sigCh)
}
<commit_msg>try env shell in unix environments<commit_after>package quantum

import (
	"fmt"
	"os"
	"os/exec"
	"runtime"
	"sync"
	"syscall"

	"github.com/mitchellh/iochan"
)

// Runner defines an interface for running commands
type Runner interface {
	Run(string, chan<- string, <-chan os.Signal) error
}

// NewBasicRunner returns a basic runner
func NewBasicRunner() (r Runner) {
	return &BasicRunner{}
}

// BasicRunner is a basic implementation of Runner
type BasicRunner struct{}

// Run runs a command and captures the output of the command, while listening
// for and sending signals to the process.
func (r *BasicRunner) Run(cmd string,
	outCh chan<- string,
	sigCh <-chan os.Signal) error {
	var shell, flag string
	if runtime.GOOS == "windows" {
		shell = "cmd"
		flag = "/C"
	} else {
		envShell := os.Getenv("SHELL")
		if envShell != "" {
			shell = envShell
		} else {
			shell = "/bin/bash"
		}
		flag = "-c"
	}
	// Tell the client what we're running.
	// Note: the tests expect this
	outCh <- "Running " + cmd + "\n"
	ec := exec.Command(shell, flag, cmd)
	return run(ec, outCh, sigCh)
}

{'fraction_non_alphanumeric': 0.12197231833910034, 'fraction_numerical': 0.0, 'mean_word_length': 3.4480769230769233, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3765302', 'n_tokens_mistral': 806, 'n_tokens_neox': 763, 'n_words': 284}