mirror of
https://github.com/actions/runner.git
synced 2026-01-10 12:30:58 +08:00
update with temp file
This commit is contained in:
@@ -337,7 +337,11 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
// These flags help validate the syntax without fully executing the script
|
// These flags help validate the syntax without fully executing the script
|
||||||
var process = new Process();
|
var process = new Process();
|
||||||
process.StartInfo.FileName = "cmd.exe";
|
process.StartInfo.FileName = "cmd.exe";
|
||||||
process.StartInfo.Arguments = $"/c /v:on /f:off /e:on \"{tempUpdatePath}\" echo SyntaxCheckOnly && exit /b 0";
|
// Use a temporary batch file to check syntax without execution
|
||||||
|
string tempBatchFile = Path.Combine(tempDir, "syntax_check.cmd");
|
||||||
|
File.WriteAllText(tempBatchFile, $"@echo off\r\necho SyntaxCheckOnly\r\nexit /b 0");
|
||||||
|
|
||||||
|
process.StartInfo.Arguments = $"/c \"{tempUpdatePath}\" \"{tempBatchFile}\"";
|
||||||
process.StartInfo.RedirectStandardError = true;
|
process.StartInfo.RedirectStandardError = true;
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user