Some updates that might be worth taking a look at. I got it “working”, well kinda working.
These are the changes I made :
else if (ExecutableInPath(builtin, out var location))
{
var startInfo = new ProcessStartInfo
{
FileName = command[0],
Arguments = string.Join(' ', command[1..]),
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true,
};
var process = new Process { StartInfo = startInfo };
process.Start();
// Print stdout
Console.Write(process.StandardOutput.ReadToEnd());
Console.Error.Write(process.StandardError.ReadToEnd());
process.WaitForExit();
//Process.Start(location, string.Join(' ', command[1..]));
}
It might look normal but as the “FileName” I now use command[0] instead of the “location” variable. This means that instead of the full path it now uses only the file name, for example “custom_exe_5370” instead of “/tmp/foo/custom_exe_5370”.
I think that this is wrong since im running windows and C# from my knowledge needs the entire path in order to open a program not only the name. Am I wrong here or is this the correct solution?