depot/pkgs/by-name/gi/github-runner/patches/use-get-directory-for-diag.patch
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

25 lines
1.2 KiB
Diff

diff --git a/src/Runner.Common/HostContext.cs b/src/Runner.Common/HostContext.cs
index 9e43464..a953694 100644
--- a/src/Runner.Common/HostContext.cs
+++ b/src/Runner.Common/HostContext.cs
@@ -119,7 +119,7 @@ namespace GitHub.Runner.Common
}
// this should give us _diag folder under runner root directory
- string diagLogDirectory = Path.Combine(new DirectoryInfo(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)).Parent.FullName, Constants.Path.DiagDirectory);
+ string diagLogDirectory = GetDirectory(WellKnownDirectory.Diag);
_traceManager = new TraceManager(new HostTraceListener(diagLogDirectory, hostType, logPageSize, logRetentionDays), stdoutTraceListener, this.SecretMasker);
}
else
@@ -297,7 +297,10 @@ namespace GitHub.Runner.Common
throw new NotSupportedException($"Unexpected well known directory: '{directory}'");
}
- _trace.Info($"Well known directory '{directory}': '{path}'");
+ if (_trace != null)
+ {
+ _trace.Info($"Well known directory '{directory}': '{path}'");
+ }
return path;
}