Ejemplo n.º 1
0
        /// <summary>
        /// Run a single scenario. Passing 0 for scenarioIndex runs all scenarios.
        /// Once the scenario is done executing, the results are copied into the
        /// results directory.
        /// 
        /// If true is returned, then exitCode was assigned and can be checked. 
        /// If false is returned the value of exitCode is considered undefined.
        /// </summary>
        /// <param name="scenarioIndex">The scenario to run.</param>
        /// <returns>false if the job was not started, true if the job started and exitcode was assigned a value.</returns>
        private bool RunJob(int scenarioIndex, ref int exitCode)
        {
            bool rval = false;
            string envOpts = string.Format("/s /r:{0} {1}", scenarioIndex, EnvxFilePath);
            ProcessTracker tracker = new ProcessTracker(EnvExePath, envOpts);
            if (tracker.Start())
            {
                tracker.WaitForCompletion();
                logger.Debug(string.Format("Envision exited. Exit code: {0}", exitCode));
                rval = true;
            }

            exitCode = tracker.ExitCode;
            return rval;
        }