Using ProcessStartInfo with wsl to access linux from W10


I tried with a program to access at my linux (on win10). It work when I tried with CMD.exe directly on windows but when i tried with code :

ProcessStartInfo start = new ProcessStartInfo(); start.FileName = "CMD.exe"; start.Arguments = string.Format("wsl "ls /home/"", cmd); start.UseShellExecute = false; start.CreateNoWindow = true; start.RedirectStandardOutput = true; start.RedirectStandardError = true; using (Process process = Process.Start(start)) { using (StreamReader reader = process.StandardOutput) { string stderr = process.StandardError.ReadToEnd(); // Here are the exceptions from our Python script string result = reader.ReadToEnd(); // Here is the result of StdOut(for example: print "test") return result; } } 

It’s doesn’t work, it’s just block indefinitely on “process.StandardError.ReadToEnd();”

Have you any ideas ?

Best Regards

submitted by /u/haloremi
[link] [comments]

Leave a Reply