syntax updates
This commit is contained in:
parent
283fa1abc2
commit
1e05d4576d
75 changed files with 3821 additions and 3905 deletions
|
|
@ -1,14 +1,13 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Insight.Agent.Extensions
|
||||
namespace Insight.Agent.Extensions;
|
||||
|
||||
public static class ConfigurationExtensions
|
||||
{
|
||||
public static class ConfigurationExtensions
|
||||
public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
|
||||
{
|
||||
public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
|
||||
{
|
||||
configuration.Sources.Clear();
|
||||
configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
||||
return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
|
||||
}
|
||||
configuration.Sources.Clear();
|
||||
configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
||||
return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,31 @@
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Insight.Agent.Extensions
|
||||
namespace Insight.Agent.Extensions;
|
||||
|
||||
public static class Linux
|
||||
{
|
||||
public static class Linux
|
||||
[SupportedOSPlatform("linux")]
|
||||
public static string Bash(this string cmd)
|
||||
{
|
||||
[SupportedOSPlatform("linux")]
|
||||
public static string Bash(this string cmd)
|
||||
var escaped = cmd.Replace("\"", "\\\"");
|
||||
|
||||
using var proc = new Process()
|
||||
{
|
||||
var escaped = cmd.Replace("\"", "\\\"");
|
||||
|
||||
using var proc = new Process()
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "/bin/bash",
|
||||
Arguments = $"-c \"{escaped}\"",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
}
|
||||
};
|
||||
FileName = "/bin/bash",
|
||||
Arguments = $"-c \"{escaped}\"",
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
}
|
||||
};
|
||||
|
||||
proc.Start();
|
||||
var result = proc.StandardOutput.ReadToEnd();
|
||||
proc.WaitForExit();
|
||||
proc.Start();
|
||||
var result = proc.StandardOutput.ReadToEnd();
|
||||
proc.WaitForExit();
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue