Skip to content

Commit

Permalink
Fix JIT configurations on Windows (actions#2497)
Browse files Browse the repository at this point in the history
* Fix JIT configurations on Windows

* Update src/Runner.Listener/Runner.cs
  • Loading branch information
MatisseHack authored Mar 21, 2023
1 parent bb7b1e8 commit 0e7ca9a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Runner.Listener/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -210,10 +211,16 @@ public async Task<int> ExecuteCommand(CommandSettings command)
foreach (var config in jitConfig)
{
var configFile = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Root), config.Key);
var configContent = Encoding.UTF8.GetString(Convert.FromBase64String(config.Value));
File.WriteAllText(configFile, configContent, Encoding.UTF8);
var configContent = Convert.FromBase64String(config.Value);
#if OS_WINDOWS
if (configFile == HostContext.GetConfigFile(WellKnownConfigFile.RSACredentials))
{
configContent = ProtectedData.Protect(configContent, null, DataProtectionScope.LocalMachine);
}
#endif
File.WriteAllBytes(configFile, configContent);
File.SetAttributes(configFile, File.GetAttributes(configFile) | FileAttributes.Hidden);
Trace.Info($"Save {configContent.Length} chars to '{configFile}'.");
Trace.Info($"Saved {configContent.Length} bytes to '{configFile}'.");
}
}
catch (Exception ex)
Expand Down

0 comments on commit 0e7ca9a

Please sign in to comment.