Skip to content

Commit

Permalink
Only set debug path when MSBuildDebugEngine is set
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmihai committed Aug 28, 2021
1 parent a636391 commit efba6a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Shared/CommunicationsUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ internal static Dictionary<string, string> GetEnvironmentVariables()
// The DebugUtils static constructor can set the MSBUILDDEBUGPATH environment variable to propagate the debug path to out of proc nodes.
// Need to ensure that constructor is called before this method returns in order to capture its env var write.
// Otherwise the env var is not captured and thus gets deleted when RequiestBuilder resets the environment based on the cached results of this method.
ErrorUtilities.VerifyThrowInternalNull(DebugUtils.DebugPath, nameof(DebugUtils.DebugPath));
ErrorUtilities.VerifyThrowInternalNull(DebugUtils.ProcessInfoString, nameof(DebugUtils.DebugPath));
#endif

Dictionary<string, string> table = new Dictionary<string, string>(200, StringComparer.OrdinalIgnoreCase); // Razzle has 150 environment variables
Expand Down
3 changes: 2 additions & 1 deletion src/Shared/Debugging/DebugUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ private enum NodeMode
static DebugUtils()
{
string environmentDebugPath = Environment.GetEnvironmentVariable("MSBUILDDEBUGPATH");
var debugDirectory = environmentDebugPath ?? Path.Combine(Directory.GetCurrentDirectory(), "MSBuild_Logs");
var debugDirectory = environmentDebugPath;

if (Traits.Instance.DebugEngine)
{
debugDirectory ??= Path.Combine(Directory.GetCurrentDirectory(), "MSBuild_Logs");
FileUtilities.EnsureDirectoryExists(debugDirectory);

// Out of proc nodes do not know the startup directory so set the environment variable for them.
Expand Down

0 comments on commit efba6a2

Please sign in to comment.