Whenever I try to execute shell commands, I get an error saying
/bin/hostname: /bin/hostname: cannot execute binary file
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
An unhandled exception has occurred: Index was outside the bounds of the array.
I currently have
public MachineData FindHostname()
{
Thread.Sleep(3000);
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "/bin/bash";
psi.Arguments = "/bin/hostname && /bin/uname";
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
Process proc = new Process
{
StartInfo = psi
};
proc.Start();
...
}
Does anyone know of a workaround?