private CompilerResult CreateCompilerResult()
 {
     return(new CompilerResult {
         StandardOutput = StandardOutput.ReadToEnd(),
         StandardError = StandardError.ReadToEnd(),
         CompilationTime = (int)ExitTime.Subtract(StartTime).TotalMilliseconds
     });
 }
예제 #2
0
 private RunResult CreateRunResult()
 {
     return(new RunResult {
         Output = StandardOutput.ReadToEnd(),
         Error = StandardError.ReadToEnd(),
         RunTime = (int)ExitTime.Subtract(StartTime).TotalMilliseconds
     });
 }
예제 #3
0
        /// <summary>
        /// Waits for process to exit or to get killed due to timed out.
        /// </summary>
        /// <remarks>
        /// After this task completes, stdout and stderr of <see cref="Process"/> are not necessarily flushed
        /// yet. If you care about those tasks completing, call <see cref="WaitForStdOutAndStdErrAsync"/>.
        /// </remarks>
        public async Task WaitForExitAsync()
        {
            Log($"waiting to exit");
            var finishedTask = await Task.WhenAny(Task.Delay(m_timeout), WhenExited);

            ExitTime = DateTime.UtcNow;

            var timedOut = finishedTask != WhenExited;

            if (timedOut)
            {
                Log($"timed out after {ExitTime.Subtract(StartTime)} (timeout: {m_timeout})");
                TimedOut = true;
                await KillAsync();
            }
            else
            {
                Log($"exited at {ExitTime}");
            }
        }