Skip to content

Commit

Permalink
Prefer dump or agent temp directory if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
Haplois committed Feb 16, 2021
1 parent 3d0ed61 commit 583b1cf
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,15 @@ protected string BuildMultipleAssemblyPath(params string[] assetNames)

protected static string GetResultsDirectory()
{
var directoryPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
// DUMP_TEMP_PATH will be used as temporary storage location
// for the dumps, this won't affect the dump uploads. Just the place where
// we store them before moving them to the final folder.

// AGENT_TEMPDIRECTORY is AzureDevops variable, which is set to path
// that is cleaned up after every job. This is preferable to use over
// just the normal temp.
var temp = Environment.GetEnvironmentVariable("VSTEST_DUMP_TEMP_PATH") ?? Environment.GetEnvironmentVariable("AGENT_TEMPDIRECTORY") ?? Path.GetTempPath();
var directoryPath = Path.Combine(temp, Guid.NewGuid().ToString("n"));

if (!Directory.Exists(directoryPath))
{
Expand Down

0 comments on commit 583b1cf

Please sign in to comment.