You've already forked sap-jenkins-library
							
							
				mirror of
				https://github.com/SAP/jenkins-library.git
				synced 2025-10-30 23:57:50 +02:00 
			
		
		
		
	[refactoring] move the shell/command related interfaces into pkg/command (#1737)
* [refactoring] move the shell/command related interfaces into pkg/command otherwise we are not able to use the corresponding mocks for the items contained in pkg since these interfaces are not visible from the pkg folder Co-authored-by: Daniel Kurzynski <daniel.kurzynski@sap.com>
This commit is contained in:
		| @@ -158,7 +158,7 @@ func pollEntity(repositoryName string, connectionDetails connectionDetailsHTTP, | ||||
| 	return status, nil | ||||
| } | ||||
|  | ||||
| func getAbapCommunicationArrangementInfo(config abapEnvironmentPullGitRepoOptions, c execRunner) (connectionDetailsHTTP, error) { | ||||
| func getAbapCommunicationArrangementInfo(config abapEnvironmentPullGitRepoOptions, c command.ExecRunner) (connectionDetailsHTTP, error) { | ||||
|  | ||||
| 	var connectionDetails connectionDetailsHTTP | ||||
| 	var error error | ||||
| @@ -185,7 +185,7 @@ func getAbapCommunicationArrangementInfo(config abapEnvironmentPullGitRepoOption | ||||
| 	return connectionDetails, error | ||||
| } | ||||
|  | ||||
| func readCfServiceKey(config abapEnvironmentPullGitRepoOptions, c execRunner) (serviceKey, error) { | ||||
| func readCfServiceKey(config abapEnvironmentPullGitRepoOptions, c command.ExecRunner) (serviceKey, error) { | ||||
|  | ||||
| 	var abapServiceKey serviceKey | ||||
|  | ||||
|   | ||||
| @@ -62,7 +62,7 @@ func artifactPrepareVersion(config artifactPrepareVersionOptions, telemetryData | ||||
|  | ||||
| var sshAgentAuth = ssh.NewSSHAgentAuth | ||||
|  | ||||
| func runArtifactPrepareVersion(config *artifactPrepareVersionOptions, telemetryData *telemetry.CustomData, commonPipelineEnvironment *artifactPrepareVersionCommonPipelineEnvironment, artifact versioning.Artifact, runner execRunner, repository gitRepository, getWorktree func(gitRepository) (gitWorktree, error)) error { | ||||
| func runArtifactPrepareVersion(config *artifactPrepareVersionOptions, telemetryData *telemetry.CustomData, commonPipelineEnvironment *artifactPrepareVersionCommonPipelineEnvironment, artifact versioning.Artifact, runner command.ExecRunner, repository gitRepository, getWorktree func(gitRepository) (gitWorktree, error)) error { | ||||
|  | ||||
| 	telemetryData.Custom1Label = "buildTool" | ||||
| 	telemetryData.Custom1 = config.BuildTool | ||||
|   | ||||
| @@ -53,7 +53,7 @@ func cloudFoundryCreateServiceKey(options cloudFoundryCreateServiceKeyOptions, t | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func runCloudFoundryCreateServiceKey(config *cloudFoundryCreateServiceKeyOptions, telemetryData *telemetry.CustomData, c execRunner) error { | ||||
| func runCloudFoundryCreateServiceKey(config *cloudFoundryCreateServiceKeyOptions, telemetryData *telemetry.CustomData, c command.ExecRunner) error { | ||||
|  | ||||
| 	log.Entry().Info("Creating Service Key") | ||||
|  | ||||
|   | ||||
| @@ -52,7 +52,7 @@ func cloudFoundryDeleteService(options cloudFoundryDeleteServiceOptions, telemet | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func cloudFoundryDeleteServiceKeys(options cloudFoundryDeleteServiceOptions, c execRunner) error { | ||||
| func cloudFoundryDeleteServiceKeys(options cloudFoundryDeleteServiceOptions, c command.ExecRunner) error { | ||||
|  | ||||
| 	log.Entry().Info("Deleting inherent Service Keys") | ||||
|  | ||||
| @@ -92,7 +92,7 @@ func cloudFoundryDeleteServiceKeys(options cloudFoundryDeleteServiceOptions, c e | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func cloudFoundryLogin(options cloudFoundryDeleteServiceOptions, c execRunner) error { | ||||
| func cloudFoundryLogin(options cloudFoundryDeleteServiceOptions, c command.ExecRunner) error { | ||||
| 	var cfLoginScript = []string{"login", "-a", options.CfAPIEndpoint, "-o", options.CfOrg, "-s", options.CfSpace, "-u", options.Username, "-p", options.Password} | ||||
|  | ||||
| 	log.Entry().WithField("cfAPI:", options.CfAPIEndpoint).WithField("cfOrg", options.CfOrg).WithField("space", options.CfSpace).Info("Logging into Cloud Foundry..") | ||||
| @@ -106,7 +106,7 @@ func cloudFoundryLogin(options cloudFoundryDeleteServiceOptions, c execRunner) e | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func cloudFoundryDeleteServiceFunction(service string, c execRunner) error { | ||||
| func cloudFoundryDeleteServiceFunction(service string, c command.ExecRunner) error { | ||||
| 	var cfdeleteServiceScript = []string{"delete-service", service, "-f"} | ||||
|  | ||||
| 	log.Entry().WithField("cfService", service).Info("Deleting the requested Service") | ||||
| @@ -120,7 +120,7 @@ func cloudFoundryDeleteServiceFunction(service string, c execRunner) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func cloudFoundryLogout(c execRunner) error { | ||||
| func cloudFoundryLogout(c command.ExecRunner) error { | ||||
| 	var cfLogoutScript = "logout" | ||||
|  | ||||
| 	log.Entry().Info("Logging out of Cloud Foundry") | ||||
|   | ||||
| @@ -19,7 +19,7 @@ func detectExecuteScan(config detectExecuteScanOptions, telemetryData *telemetry | ||||
| 	runDetect(config, &c) | ||||
| } | ||||
|  | ||||
| func runDetect(config detectExecuteScanOptions, command shellRunner) { | ||||
| func runDetect(config detectExecuteScanOptions, command command.ShellRunner) { | ||||
| 	// detect execution details, see https://synopsys.atlassian.net/wiki/spaces/INTDOCS/pages/88440888/Sample+Synopsys+Detect+Scan+Configuration+Scenarios+for+Black+Duck | ||||
|  | ||||
| 	args := []string{"bash <(curl -s https://detect.synopsys.com/detect.sh)"} | ||||
|   | ||||
| @@ -34,7 +34,7 @@ func gctsCreateRepository(config gctsCreateRepositoryOptions, telemetryData *tel | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func createRepository(config *gctsCreateRepositoryOptions, telemetryData *telemetry.CustomData, command execRunner, httpClient piperhttp.Sender) error { | ||||
| func createRepository(config *gctsCreateRepositoryOptions, telemetryData *telemetry.CustomData, command command.ExecRunner, httpClient piperhttp.Sender) error { | ||||
|  | ||||
| 	cookieJar, cookieErr := cookiejar.New(nil) | ||||
| 	if cookieErr != nil { | ||||
|   | ||||
| @@ -32,7 +32,7 @@ func gctsDeploy(config gctsDeployOptions, telemetryData *telemetry.CustomData) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func deployCommit(config *gctsDeployOptions, telemetryData *telemetry.CustomData, command execRunner, httpClient piperhttp.Sender) error { | ||||
| func deployCommit(config *gctsDeployOptions, telemetryData *telemetry.CustomData, command command.ExecRunner, httpClient piperhttp.Sender) error { | ||||
|  | ||||
| 	cookieJar, cookieErr := cookiejar.New(nil) | ||||
| 	if cookieErr != nil { | ||||
|   | ||||
| @@ -1,24 +0,0 @@ | ||||
| package cmd | ||||
|  | ||||
| import ( | ||||
| 	"github.com/SAP/jenkins-library/pkg/command" | ||||
| 	"io" | ||||
| ) | ||||
|  | ||||
| type runner interface { | ||||
| 	SetDir(d string) | ||||
| 	SetEnv(e []string) | ||||
| 	Stdout(out io.Writer) | ||||
| 	Stderr(err io.Writer) | ||||
| } | ||||
|  | ||||
| type execRunner interface { | ||||
| 	runner | ||||
| 	RunExecutable(e string, p ...string) error | ||||
| 	RunExecutableInBackground(executable string, params ...string) (command.Execution, error) | ||||
| } | ||||
|  | ||||
| type shellRunner interface { | ||||
| 	runner | ||||
| 	RunShell(s string, c string) error | ||||
| } | ||||
| @@ -17,7 +17,7 @@ func karmaExecuteTests(config karmaExecuteTestsOptions, telemetryData *telemetry | ||||
| 	runKarma(config, &c) | ||||
| } | ||||
|  | ||||
| func runKarma(config karmaExecuteTestsOptions, command execRunner) { | ||||
| func runKarma(config karmaExecuteTestsOptions, command command.ExecRunner) { | ||||
| 	installCommandTokens := tokenize(config.InstallCommand) | ||||
| 	command.SetDir(config.ModulePath) | ||||
| 	err := command.RunExecutable(installCommandTokens[0], installCommandTokens[1:]...) | ||||
|   | ||||
| @@ -31,7 +31,7 @@ func kubernetesDeploy(config kubernetesDeployOptions, telemetryData *telemetry.C | ||||
| 	runKubernetesDeploy(config, &c, log.Writer()) | ||||
| } | ||||
|  | ||||
| func runKubernetesDeploy(config kubernetesDeployOptions, command execRunner, stdout io.Writer) { | ||||
| func runKubernetesDeploy(config kubernetesDeployOptions, command command.ExecRunner, stdout io.Writer) { | ||||
| 	if config.DeployTool == "helm" || config.DeployTool == "helm3" { | ||||
| 		runHelmDeploy(config, command, stdout) | ||||
| 	} else { | ||||
| @@ -39,7 +39,7 @@ func runKubernetesDeploy(config kubernetesDeployOptions, command execRunner, std | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func runHelmDeploy(config kubernetesDeployOptions, command execRunner, stdout io.Writer) { | ||||
| func runHelmDeploy(config kubernetesDeployOptions, command command.ExecRunner, stdout io.Writer) { | ||||
| 	_, containerRegistry, err := splitRegistryURL(config.ContainerRegistryURL) | ||||
| 	if err != nil { | ||||
| 		log.Entry().WithError(err).Fatalf("Container registry url '%v' incorrect", config.ContainerRegistryURL) | ||||
| @@ -147,7 +147,7 @@ func runHelmDeploy(config kubernetesDeployOptions, command execRunner, stdout io | ||||
|  | ||||
| } | ||||
|  | ||||
| func runKubectlDeploy(config kubernetesDeployOptions, command execRunner) { | ||||
| func runKubectlDeploy(config kubernetesDeployOptions, command command.ExecRunner) { | ||||
| 	_, containerRegistry, err := splitRegistryURL(config.ContainerRegistryURL) | ||||
| 	if err != nil { | ||||
| 		log.Entry().WithError(err).Fatalf("Container registry url '%v' incorrect", config.ContainerRegistryURL) | ||||
|   | ||||
| @@ -51,7 +51,7 @@ func malwareExecuteScan(config malwareExecuteScanOptions, telemetryData *telemet | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func runMalwareScan(config *malwareExecuteScanOptions, telemetryData *telemetry.CustomData, command execRunner, | ||||
| func runMalwareScan(config *malwareExecuteScanOptions, telemetryData *telemetry.CustomData, command command.ExecRunner, | ||||
| 	httpClient piperhttp.Sender) error { | ||||
|  | ||||
| 	log.Entry().Infof("Scanning file \"%s\" for malware using service \"%s\"", config.File, config.Host) | ||||
|   | ||||
| @@ -22,7 +22,7 @@ func mavenBuild(config mavenBuildOptions, telemetryData *telemetry.CustomData) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func runMavenBuild(config *mavenBuildOptions, telemetryData *telemetry.CustomData, command execRunner, utils piperutils.FileUtils) error { | ||||
| func runMavenBuild(config *mavenBuildOptions, telemetryData *telemetry.CustomData, command command.ExecRunner, utils piperutils.FileUtils) error { | ||||
| 	var flags = []string{"-update-snapshots", "--batch-mode"} | ||||
|  | ||||
| 	exists, _ := utils.FileExists("integration-tests/pom.xml") | ||||
|   | ||||
| @@ -19,7 +19,7 @@ func mavenExecute(config mavenExecuteOptions, _ *telemetry.CustomData) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func runMavenExecute(config mavenExecuteOptions, runner execRunner) error { | ||||
| func runMavenExecute(config mavenExecuteOptions, runner command.ExecRunner) error { | ||||
| 	options := maven.ExecuteOptions{ | ||||
| 		PomPath:                     config.PomPath, | ||||
| 		ProjectSettingsFile:         config.ProjectSettingsFile, | ||||
|   | ||||
| @@ -18,7 +18,7 @@ func mavenExecuteStaticCodeChecks(config mavenExecuteStaticCodeChecksOptions, te | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func runMavenStaticCodeChecks(config *mavenExecuteStaticCodeChecksOptions, telemetryData *telemetry.CustomData, command execRunner) error { | ||||
| func runMavenStaticCodeChecks(config *mavenExecuteStaticCodeChecksOptions, telemetryData *telemetry.CustomData, command command.ExecRunner) error { | ||||
| 	var defines []string | ||||
| 	var goals []string | ||||
|  | ||||
|   | ||||
| @@ -97,7 +97,7 @@ func mtaBuild(config mtaBuildOptions, | ||||
|  | ||||
| func runMtaBuild(config mtaBuildOptions, | ||||
| 	commonPipelineEnvironment *mtaBuildCommonPipelineEnvironment, | ||||
| 	e execRunner, | ||||
| 	e command.ExecRunner, | ||||
| 	p piperutils.FileUtils, | ||||
| 	httpClient piperhttp.Downloader, | ||||
| 	npmExecutor npm.Executor) error { | ||||
| @@ -205,7 +205,7 @@ func runMtaBuild(config mtaBuildOptions, | ||||
| 	return err | ||||
| } | ||||
|  | ||||
| func installMavenArtifacts(e execRunner, config mtaBuildOptions) error { | ||||
| func installMavenArtifacts(e command.ExecRunner, config mtaBuildOptions) error { | ||||
| 	pomXMLExists, err := piperutils.FileExists("pom.xml") | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| @@ -230,7 +230,7 @@ func getMarJarName(config mtaBuildOptions) string { | ||||
| 	return mtaJar | ||||
| } | ||||
|  | ||||
| func addNpmBinToPath(e execRunner) error { | ||||
| func addNpmBinToPath(e command.ExecRunner) error { | ||||
| 	dir, _ := os.Getwd() | ||||
| 	newPath := path.Join(dir, "node_modules", ".bin") | ||||
| 	oldPath := os.Getenv("PATH") | ||||
|   | ||||
| @@ -34,7 +34,7 @@ type nexusUploadUtils interface { | ||||
| 	UsesNpm() bool | ||||
|  | ||||
| 	getEnvParameter(path, name string) string | ||||
| 	getExecRunner() execRunner | ||||
| 	getExecRunner() command.ExecRunner | ||||
| 	evaluate(options *maven.EvaluateOptions, expression string) (string, error) | ||||
| } | ||||
|  | ||||
| @@ -66,7 +66,7 @@ func (u *utilsBundle) getEnvParameter(path, name string) string { | ||||
| 	return piperenv.GetParameter(path, name) | ||||
| } | ||||
|  | ||||
| func (u *utilsBundle) getExecRunner() execRunner { | ||||
| func (u *utilsBundle) getExecRunner() command.ExecRunner { | ||||
| 	if u.execRunner == nil { | ||||
| 		u.execRunner = &command.Command{} | ||||
| 		u.execRunner.Stdout(log.Writer()) | ||||
| @@ -317,7 +317,7 @@ func appendItemToString(list, item string, first bool) string { | ||||
| } | ||||
|  | ||||
| func uploadArtifactsBundle(d artifactDefines, generatePOM bool, mavenOptions maven.ExecuteOptions, | ||||
| 	execRunner execRunner) error { | ||||
| 	execRunner command.ExecRunner) error { | ||||
| 	if d.file == "" { | ||||
| 		return fmt.Errorf("no file specified") | ||||
| 	} | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package cmd | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"github.com/SAP/jenkins-library/pkg/command" | ||||
| 	"github.com/SAP/jenkins-library/pkg/maven" | ||||
| 	"github.com/SAP/jenkins-library/pkg/mock" | ||||
| 	"github.com/SAP/jenkins-library/pkg/nexus" | ||||
| @@ -46,7 +47,7 @@ func (m *mockUtilsBundle) getEnvParameter(path, name string) string { | ||||
| 	return m.cpe[path] | ||||
| } | ||||
|  | ||||
| func (m *mockUtilsBundle) getExecRunner() execRunner { | ||||
| func (m *mockUtilsBundle) getExecRunner() command.ExecRunner { | ||||
| 	return &m.execRunner | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -19,7 +19,7 @@ import ( | ||||
| type lintUtils interface { | ||||
| 	Glob(pattern string) (matches []string, err error) | ||||
|  | ||||
| 	getExecRunner() execRunner | ||||
| 	getExecRunner() command.ExecRunner | ||||
| 	getGeneralPurposeConfig(configURL string) | ||||
| } | ||||
|  | ||||
| @@ -36,7 +36,7 @@ func newLintUtilsBundle() *lintUtilsBundle { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (u *lintUtilsBundle) getExecRunner() execRunner { | ||||
| func (u *lintUtilsBundle) getExecRunner() command.ExecRunner { | ||||
| 	if u.execRunner == nil { | ||||
| 		u.execRunner = &command.Command{} | ||||
| 		u.execRunner.Stdout(log.Writer()) | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package cmd | ||||
|  | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"github.com/SAP/jenkins-library/pkg/command" | ||||
| 	"github.com/SAP/jenkins-library/pkg/mock" | ||||
| 	"github.com/SAP/jenkins-library/pkg/npm" | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| @@ -14,7 +15,7 @@ type mockLintUtilsBundle struct { | ||||
| 	execRunner *mock.ExecMockRunner | ||||
| } | ||||
|  | ||||
| func (u *mockLintUtilsBundle) getExecRunner() execRunner { | ||||
| func (u *mockLintUtilsBundle) getExecRunner() command.ExecRunner { | ||||
| 	return u.execRunner | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -70,7 +70,7 @@ func sonarExecuteScan(config sonarExecuteScanOptions, _ *telemetry.CustomData, i | ||||
| 	influx.step_data.fields.sonar = "true" | ||||
| } | ||||
|  | ||||
| func runSonar(config sonarExecuteScanOptions, client piperhttp.Downloader, runner execRunner) error { | ||||
| func runSonar(config sonarExecuteScanOptions, client piperhttp.Downloader, runner command.ExecRunner) error { | ||||
| 	if len(config.Host) > 0 { | ||||
| 		sonar.addEnvironment("SONAR_HOST_URL=" + config.Host) | ||||
| 	} | ||||
| @@ -202,7 +202,7 @@ func loadSonarScanner(url string, client piperhttp.Downloader) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func loadCertificates(certificateString string, client piperhttp.Downloader, runner execRunner) error { | ||||
| func loadCertificates(certificateString string, client piperhttp.Downloader, runner command.ExecRunner) error { | ||||
| 	trustStoreFile := filepath.Join(getWorkingDir(), ".certificates", "cacerts") | ||||
|  | ||||
| 	if exists, _ := fileUtilsExists(trustStoreFile); exists { | ||||
|   | ||||
| @@ -119,7 +119,7 @@ func xsDeploy(config xsDeployOptions, telemetryData *telemetry.CustomData, piper | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func runXsDeploy(XsDeployOptions xsDeployOptions, piperEnvironment *xsDeployCommonPipelineEnvironment, s shellRunner, | ||||
| func runXsDeploy(XsDeployOptions xsDeployOptions, piperEnvironment *xsDeployCommonPipelineEnvironment, s command.ShellRunner, | ||||
| 	fileUtils piperutils.FileUtils, | ||||
| 	fRemove func(string) error, | ||||
| 	stdout io.Writer) error { | ||||
| @@ -355,7 +355,7 @@ func retrieveOperationID(deployLog, pattern string) string { | ||||
| 	return operationID | ||||
| } | ||||
|  | ||||
| func xsLogin(XsDeployOptions xsDeployOptions, s shellRunner) error { | ||||
| func xsLogin(XsDeployOptions xsDeployOptions, s command.ShellRunner) error { | ||||
|  | ||||
| 	log.Entry().Debugf("Performing xs login. api-url: '%s', org: '%s', space: '%s'", | ||||
| 		XsDeployOptions.APIURL, XsDeployOptions.Org, XsDeployOptions.Space) | ||||
| @@ -371,7 +371,7 @@ func xsLogin(XsDeployOptions xsDeployOptions, s shellRunner) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func xsLogout(XsDeployOptions xsDeployOptions, s shellRunner) error { | ||||
| func xsLogout(XsDeployOptions xsDeployOptions, s command.ShellRunner) error { | ||||
|  | ||||
| 	log.Entry().Debug("Performing xs logout.") | ||||
|  | ||||
| @@ -383,7 +383,7 @@ func xsLogout(XsDeployOptions xsDeployOptions, s shellRunner) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func deploy(mode DeployMode, XsDeployOptions xsDeployOptions, s shellRunner) error { | ||||
| func deploy(mode DeployMode, XsDeployOptions xsDeployOptions, s command.ShellRunner) error { | ||||
|  | ||||
| 	deployCommand, err := mode.GetDeployCommand() | ||||
| 	if err != nil { | ||||
| @@ -404,7 +404,7 @@ func deploy(mode DeployMode, XsDeployOptions xsDeployOptions, s shellRunner) err | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func complete(mode DeployMode, action Action, operationID string, s shellRunner) error { | ||||
| func complete(mode DeployMode, action Action, operationID string, s command.ShellRunner) error { | ||||
| 	log.Entry().Debugf("Performing xs %s", action) | ||||
|  | ||||
| 	type completeProperties struct { | ||||
| @@ -423,7 +423,7 @@ func complete(mode DeployMode, action Action, operationID string, s shellRunner) | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func executeCmd(templateID string, commandPattern string, properties interface{}, s shellRunner) error { | ||||
| func executeCmd(templateID string, commandPattern string, properties interface{}, s command.ShellRunner) error { | ||||
|  | ||||
| 	tmpl, e := template.New(templateID).Parse(commandPattern) | ||||
| 	if e != nil { | ||||
|   | ||||
| @@ -24,6 +24,26 @@ type Command struct { | ||||
| 	exitCode             int | ||||
| } | ||||
|  | ||||
| type runner interface { | ||||
| 	SetDir(d string) | ||||
| 	SetEnv(e []string) | ||||
| 	Stdout(out io.Writer) | ||||
| 	Stderr(err io.Writer) | ||||
| } | ||||
|  | ||||
| // ExecRunner mock for intercepting calls to executables | ||||
| type ExecRunner interface { | ||||
| 	runner | ||||
| 	RunExecutable(e string, p ...string) error | ||||
| 	RunExecutableInBackground(executable string, params ...string) (Execution, error) | ||||
| } | ||||
|  | ||||
| // ShellRunner mock for intercepting shell calls | ||||
| type ShellRunner interface { | ||||
| 	runner | ||||
| 	RunShell(s string, c string) error | ||||
| } | ||||
|  | ||||
| // SetDir sets the working directory for the execution | ||||
| func (c *Command) SetDir(d string) { | ||||
| 	c.dir = d | ||||
|   | ||||
		Reference in New Issue
	
	Block a user