Esempio n. 1
0
// Looks for a runner configuration inside the runner directory
// finds the runner configuration matching to the manifest and executes the commands for the current OS
func startRunner(manifest *manifest.Manifest, port string, log *logger.GaugeLogger, killChannel chan bool) (*TestRunner, error) {
	var r Runner
	runnerDir, err := getLanguageJSONFilePath(manifest, &r)
	if err != nil {
		return nil, err
	}
	compatibilityErr := version.CheckCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport)
	if compatibilityErr != nil {
		return nil, errors.New(fmt.Sprintf("Compatible runner version to %s not found. To update plugin, run `gauge --update {pluginName}`.", version.CurrentGaugeVersion))
	}
	command := getOsSpecificCommand(r)
	env := getCleanEnv(port, os.Environ())
	cmd, err := common.ExecuteCommandWithEnv(command, runnerDir, log, log, env)
	if err != nil {
		return nil, err
	}
	go func() {
		select {
		case <-killChannel:
			cmd.Process.Kill()
		}
	}()
	// Wait for the process to exit so we will get a detailed error message
	errChannel := make(chan error)
	waitAndGetErrorMessage(errChannel, cmd, log)
	return &TestRunner{Cmd: cmd, ErrorChannel: errChannel}, nil
}
Esempio n. 2
0
File: runner.go Progetto: jean/gauge
// Looks for a runner configuration inside the runner directory
// finds the runner configuration matching to the manifest and executes the commands for the current OS
func startRunner(manifest *manifest.Manifest, port string, reporter reporter.Reporter, killChannel chan bool) (*TestRunner, error) {
	var r Runner
	runnerDir, err := getLanguageJSONFilePath(manifest, &r)
	if err != nil {
		return nil, err
	}
	compatibilityErr := version.CheckCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport)
	if compatibilityErr != nil {
		return nil, fmt.Errorf("Compatibility error. %s", compatibilityErr.Error())
	}
	command := getOsSpecificCommand(r)
	env := getCleanEnv(port, os.Environ())
	cmd, err := common.ExecuteCommandWithEnv(command, runnerDir, reporter, reporter, env)
	if err != nil {
		return nil, err
	}
	go func() {
		select {
		case <-killChannel:
			cmd.Process.Kill()
		}
	}()
	// Wait for the process to exit so we will get a detailed error message
	errChannel := make(chan error)
	testRunner := &TestRunner{Cmd: cmd, ErrorChannel: errChannel, mutex: &sync.Mutex{}}
	testRunner.waitAndGetErrorMessage()
	return testRunner, nil
}
Esempio n. 3
0
// Looks for a runner configuration inside the runner directory
// finds the runner configuration matching to the manifest and executes the commands for the current OS
func startRunner(manifest *manifest, port string, writer executionLogger) (*testRunner, error) {
	var r runner
	runnerDir, err := getLanguageJSONFilePath(manifest, &r)
	if err != nil {
		return nil, err
	}
	compatibilityErr := checkCompatibility(version.CurrentGaugeVersion, &r.GaugeVersionSupport)
	if compatibilityErr != nil {
		return nil, errors.New(fmt.Sprintf("Compatible runner version to %s not found. To update plugin, run `gauge --update {pluginName}`.", version.CurrentGaugeVersion))
	}
	command := getOsSpecificCommand(r)
	env := getCleanEnv(port, os.Environ())
	cmd, err := common.ExecuteCommandWithEnv(command, runnerDir, writer, writer, env)
	if err != nil {
		return nil, err
	}
	// Wait for the process to exit so we will get a detailed error message
	errChannel := make(chan error)
	waitAndGetErrorMessage(errChannel, cmd, writer)
	return &testRunner{cmd: cmd, errorChannel: errChannel}, nil
}