Beispiel #1
0
        protected override void ExecuteTask()
        {
            this.Process = this.StartProcess();

            if (this.RedirectOutput)
            {
                Thread outputThread = null;
                Thread errorThread  = null;
                outputThread = new Thread(new ThreadStart(StreamReaderThread_Output));
                errorThread  = new Thread(new ThreadStart(StreamReaderThread_Error));

                outputThread.IsBackground = true;
                errorThread.IsBackground  = true;

                _stdOut   = this.Process.StandardOutput;
                _stdError = this.Process.StandardError;

                outputThread.Start();
                errorThread.Start();
            }

            if (this.TaskName != string.Empty && this.WaitForExit == false)
            {
                Log(Level.Warning, "You set the attribute taskname to {0} and waitforexit to false.  You will not be able to call the waitforexit task with the task name {0} with an error.  If you wanted to wait for this to exit please set waitforexit to true.", this.TaskName);
            }
            if (this.TaskName != string.Empty && this.WaitForExit)
            {
                AsyncExecList.Add(this.TaskName, this);
            }
            if (this.TaskName == string.Empty && this.WaitForExit)
            {
                this.Wait();
            }
        }
Beispiel #2
0
 protected override void ExecuteTask()
 {
     this.Process = this.StartProcess();
     if (this.TaskName != string.Empty && this.WaitForExit == false)
     {
         Log(Level.Warning, "You set the attribute taskname to {0} and waitforexit to false.  You will not be able to call the waitforexit task with the task name {0} with an error.  If you wanted to wait for this to exit please set waitforexit to true.", this.TaskName);
     }
     if (this.TaskName != string.Empty && this.WaitForExit)
     {
         AsyncExecList.Add(this.TaskName, this);
     }
     if (this.TaskName == string.Empty && this.WaitForExit)
     {
         this.Wait();
     }
 }