-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlauncher.cs
More file actions
40 lines (33 loc) · 1.13 KB
/
launcher.cs
File metadata and controls
40 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Diagnostics;
class Program
{
static void Main()
{
// Define the path to the Go executable
string goExecutablePath = "path_to_your_go_executable/hello";
// Create a new process
Process process = new Process();
process.StartInfo.FileName = goExecutablePath;
process.StartInfo.Arguments = ""; // Pass arguments if needed
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
// Start the process
process.Start();
// Read the output
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
// Wait for the process to exit
process.WaitForExit();
// Print the output and error (if any)
Console.WriteLine("Output:");
Console.WriteLine(output);
if (!string.IsNullOrEmpty(error))
{
Console.WriteLine("Error:");
Console.WriteLine(error);
}
}
}