Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0091af6ae | ||
|
|
70df39c4c8 | ||
|
|
d44f364924 | ||
|
|
4095c3c4a8 | ||
|
|
1f94f028c6 | ||
|
|
d34ba4e43a |
|
|
@ -28,6 +28,7 @@ namespace CodeRelease.BLL
|
||||||
int exitCode = 0;
|
int exitCode = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Log.Logger.Information($"开始执行linux {command}");
|
||||||
// 创建一个新的进程
|
// 创建一个新的进程
|
||||||
using (Process process = new Process())
|
using (Process process = new Process())
|
||||||
{
|
{
|
||||||
|
|
@ -41,21 +42,24 @@ namespace CodeRelease.BLL
|
||||||
// 绑定输出和错误数据接收事件
|
// 绑定输出和错误数据接收事件
|
||||||
process.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
|
process.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
|
||||||
{
|
{
|
||||||
Log.Logger.Information("linux执行出错OutputDataReceived,命令{command},sender:{sender}Output:{e}", command, JsonConvert.SerializeObject(sender), JsonConvert.SerializeObject(e));
|
//Log.Logger.Information($"linux执行出错OutputDataReceived,命令{command}");
|
||||||
|
//Log.Logger.Information($"linux执行出错OutputDataReceived,Output{JsonConvert.SerializeObject(e)}");
|
||||||
if (!string.IsNullOrEmpty(e.Data))
|
if (!string.IsNullOrEmpty(e.Data))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Output: {e.Data}");
|
//Console.WriteLine($"Output: {e.Data}");
|
||||||
outputDataReceived = e.Data;
|
|
||||||
|
outputDataReceived += e.Data + "\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
process.ErrorDataReceived += new DataReceivedEventHandler((sender, e) =>
|
process.ErrorDataReceived += new DataReceivedEventHandler((sender, e) =>
|
||||||
{
|
{
|
||||||
Log.Logger.Information("linux执行出错ErrorDataReceived,命令{command},sender:{sender}Output:{e}", command, JsonConvert.SerializeObject(sender), JsonConvert.SerializeObject(e));
|
// Log.Logger.Information($"linux执行出错ErrorDataReceived,命令{command}");
|
||||||
|
//Log.Logger.Information($"linux执行出错ErrorDataReceived,Output:{JsonConvert.SerializeObject(e)}");
|
||||||
if (!string.IsNullOrEmpty(e.Data))
|
if (!string.IsNullOrEmpty(e.Data))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Error: {e.Data}");
|
//Console.WriteLine($"Error: {e.Data}");
|
||||||
errorDataReceived = e.Data;
|
errorDataReceived += e.Data + "\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -71,7 +75,9 @@ namespace CodeRelease.BLL
|
||||||
|
|
||||||
// 输出退出代码
|
// 输出退出代码
|
||||||
//Console.WriteLine($"Process exited with code {process.ExitCode}");
|
//Console.WriteLine($"Process exited with code {process.ExitCode}");
|
||||||
Log.Logger.Information($"执行结束 {process.ExitCode}");
|
Log.Logger.Information($"执行结束:{process.ExitCode}");
|
||||||
|
Log.Logger.Information($"{outputDataReceived}");
|
||||||
|
Log.Logger.Information($"{errorDataReceived}");
|
||||||
exitCode = process.ExitCode;
|
exitCode = process.ExitCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,11 @@ namespace CodeRelease.Controllers
|
||||||
var version = releaseAction.Release.TagName;
|
var version = releaseAction.Release.TagName;
|
||||||
var mingling = giteaWebhookConfig.MakeFile
|
var mingling = giteaWebhookConfig.MakeFile
|
||||||
.Replace("{version}", version)
|
.Replace("{version}", version)
|
||||||
|
.Replace("{description}", releaseAction.Release.Body)
|
||||||
|
.Replace("{name}", version)
|
||||||
|
//.Replace("{version}", version)
|
||||||
|
//.Replace("{version}", version)
|
||||||
|
//.Replace("{version}", version)
|
||||||
//.Replace("{dir_file_path}", download + "/")
|
//.Replace("{dir_file_path}", download + "/")
|
||||||
.Replace("{target_commitish}", releaseAction.Release.TargetCommitish);
|
.Replace("{target_commitish}", releaseAction.Release.TargetCommitish);
|
||||||
Log.Logger.Information("执行linux命令{mingling}", mingling);
|
Log.Logger.Information("执行linux命令{mingling}", mingling);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ app.MapGet("/system", () =>
|
||||||
long memoryUsage = currentProcess.WorkingSet64;
|
long memoryUsage = currentProcess.WorkingSet64;
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
msg = $"系统版本:{InformationalVersion},启动时间:{startDateTime.ToString("yyyy-MM-dd HH:mm:ss")},已安全运行时间:{DateTime.Now.Subtract(startDateTime).TotalMinutes.ToString("#.##")}分钟",
|
msg = $"系统版本:{InformationalVersion},启动时间:{startDateTime.ToString("yyyy-MM-dd HH:mm:ss")},已安全运行时间:{DateTime.Now.Subtract(startDateTime).TotalMinutes.ToString("0.##")}分钟",
|
||||||
InformationalVersion,
|
InformationalVersion,
|
||||||
startDateTime,
|
startDateTime,
|
||||||
MemoryUsage = $"{memoryUsage / (1024.0 * 1024.0):F2}MB",
|
MemoryUsage = $"{memoryUsage / (1024.0 * 1024.0):F2}MB",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user