Skip to content

Commit ab423a3

Browse files
committed
Ensure IProcessProxy.ExitTime is set when an operation is cancelled or experiences a timeout.
1 parent ad1e055 commit ab423a3

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

.pipelines/azure-pipelines-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ resources:
1616
options: --entrypoint=""
1717

1818
variables:
19-
VcVersion : 1.14.16
19+
VcVersion : 1.14.17
2020
ROOT: $(Build.SourcesDirectory)
2121
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2222
ENABLE_PRS_DELAYSIGN: 1

.pipelines/azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pool:
1818
vmImage: windows-latest
1919

2020
variables:
21-
VcVersion : 1.14.16
21+
VcVersion : 1.14.17
2222
ROOT: $(Build.SourcesDirectory)
2323
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2424
ENABLE_PRS_DELAYSIGN: 1

src/VirtualClient/VirtualClient.Common/IProcessProxy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface IProcessProxy : IDisposable
3939
/// <summary>
4040
/// Gets the exit time for the underlying process.
4141
/// </summary>
42-
DateTime ExitTime { get; }
42+
DateTime ExitTime { get; set; }
4343

4444
/// <summary>
4545
/// The underlying process details.
@@ -97,7 +97,7 @@ public interface IProcessProxy : IDisposable
9797
/// <summary>
9898
/// Gets the start time for the underlying process.
9999
/// </summary>
100-
DateTime StartTime { get; }
100+
DateTime StartTime { get; set; }
101101

102102
/// <summary>
103103
/// Gracefully closes the process and main window.

src/VirtualClient/VirtualClient.Common/ProcessExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static async Task StartAndWaitAsync(this IProcessProxy process, Cancellat
8383

8484
if (process.Start())
8585
{
86-
await process.WaitForExitAsync(cancellationToken, timeout).ConfigureAwait(false);
86+
await process.WaitForExitAsync(cancellationToken, timeout);
8787
}
8888
}
8989

src/VirtualClient/VirtualClient.Common/ProcessProxy.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,10 @@ public virtual async Task WaitForExitAsync(CancellationToken cancellationToken,
365365
{
366366
// Expected whenever the CancellationToken receives a cancellation request.
367367
}
368+
finally
369+
{
370+
this.exitTime = DateTime.UtcNow;
371+
}
368372
}
369373

370374
/// <summary>

src/VirtualClient/VirtualClient.Contracts/VirtualClientLoggingExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,6 @@ public static void LogMetrics(
762762
metricName.ThrowIfNullOrWhiteSpace(nameof(metricName));
763763
toolName.ThrowIfNullOrWhiteSpace(nameof(toolName));
764764
eventContext.ThrowIfNull(nameof(eventContext));
765-
scenarioStartTime.ThrowIfInvalid(nameof(scenarioStartTime), (time) => time != DateTime.MinValue);
766-
scenarioEndTime.ThrowIfInvalid(nameof(scenarioEndTime), (time) => time != DateTime.MinValue);
767765

768766
var properties = new Dictionary<string, object>
769767
{

0 commit comments

Comments
 (0)