private bool IsArm64Process() { if (Environment.OSVersion.Platform != PlatformID.Unix || !Environment.Is64BitProcess) { return(false); } try { var process = new global::System.Diagnostics.Process(); process.StartInfo.FileName = "uname"; process.StartInfo.Arguments = "-m"; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.Start(); process.WaitForExit(); var output = process.StandardOutput.ReadToEnd(); return(output.Trim() == "aarch64"); } catch { return(false); } }
/// 実行ボタンクリック時の動作 public void Execute() { global::System.Diagnostics.ProcessStartInfo psInfo = new global::System.Diagnostics.ProcessStartInfo(); psInfo.FileName = this.FileName; psInfo.WorkingDirectory = this.WorkingDirectory; psInfo.Arguments = this.Arguments; psInfo.CreateNoWindow = true; psInfo.UseShellExecute = false; psInfo.RedirectStandardInput = true; psInfo.RedirectStandardOutput = true; psInfo.RedirectStandardError = true; // Process p = Process.Start(psInfo); p = new global::System.Diagnostics.Process(); p.StartInfo = psInfo; p.OutputDataReceived += p_OutputDataReceived; p.ErrorDataReceived += p_ErrorDataReceived; // プロセスの実行 p.Start(); // 標準入力への書き込み //if (InputString.Length > 0) p_WriteInputData(InputString); //非同期で出力とエラーの読み取りを開始 p.BeginOutputReadLine(); p.BeginErrorReadLine(); // 終わるまでまつ p.WaitForExit(); this.ExitCode = p.ExitCode; this.StandardOutput = standardOutputStringBuilder.ToString(); }
public static void ExecuteBatchScript(string fileName) { var process = new global::System.Diagnostics.Process { StartInfo = { FileName = fileName } }; process.Start(); process.WaitForExit(); }
private bool IsArm64Process () { if (Environment.OSVersion.Platform != PlatformID.Unix || !Environment.Is64BitProcess) return false; try { var process = new global::System.Diagnostics.Process (); process.StartInfo.FileName = "uname"; process.StartInfo.Arguments = "-m"; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.Start (); process.WaitForExit (); var output = process.StandardOutput.ReadToEnd (); return output.Trim () == "aarch64"; } catch { return false; } }
public static int command(string cmd, global::Array <string> args) { #line 106 "/opt/haxe/std/cs/_std/Sys.hx" global::System.Diagnostics.Process proc = global::sys.io.Process.createNativeProcess(cmd, args); global::System.Diagnostics.DataReceivedEventHandler this1 = ((global::System.Diagnostics.DataReceivedEventHandler)((((global::Sys_command_107__Fun.__hx_current != null)) ? (global::Sys_command_107__Fun.__hx_current) : (global::Sys_command_107__Fun.__hx_current = ((global::Sys_command_107__Fun)(new global::Sys_command_107__Fun())))).Delegate)); proc.OutputDataReceived += ((global::System.Diagnostics.DataReceivedEventHandler)(this1)); #line 112 "/opt/haxe/std/cs/_std/Sys.hx" global::haxe.io.Output stderr = ((global::haxe.io.Output)(new global::cs.io.NativeOutput(((global::System.IO.Stream)(global::System.Console.OpenStandardError()))))); global::System.Diagnostics.DataReceivedEventHandler this2 = ((global::System.Diagnostics.DataReceivedEventHandler)(new global::Sys_command_113__Fun(stderr).Delegate)); proc.ErrorDataReceived += ((global::System.Diagnostics.DataReceivedEventHandler)(this2)); #line 118 "/opt/haxe/std/cs/_std/Sys.hx" proc.Start(); proc.BeginOutputReadLine(); #line 120 "/opt/haxe/std/cs/_std/Sys.hx" proc.BeginErrorReadLine(); proc.WaitForExit(); #line 122 "/opt/haxe/std/cs/_std/Sys.hx" int exitCode = proc.ExitCode; (proc as global::System.ComponentModel.Component).Dispose(); #line 124 "/opt/haxe/std/cs/_std/Sys.hx" return(exitCode); }
private bool IsArm64Process() { if (!GDIPlus.RunningOnUnix()) { return(false); } try { var process = new global::System.Diagnostics.Process(); process.StartInfo.FileName = "uname"; process.StartInfo.Arguments = "-m"; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.Start(); process.WaitForExit(); var output = process.StandardOutput.ReadToEnd(); return(output.Trim() == "aarch64"); } catch { return(false); } }