From 79dd44db09db2b2fb7c5f0b820ce7da823e292c6 Mon Sep 17 00:00:00 2001 From: glucaci Date: Fri, 16 Dec 2016 12:07:03 +0100 Subject: [PATCH] Test debugging code --- LibMpcTest/MpdServerTest.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/LibMpcTest/MpdServerTest.cs b/LibMpcTest/MpdServerTest.cs index 07563c1..e3b638f 100644 --- a/LibMpcTest/MpdServerTest.cs +++ b/LibMpcTest/MpdServerTest.cs @@ -32,6 +32,35 @@ namespace LibMpcTest Process.Start(); LogOutput = Process.StandardOutput.ReadToEnd(); LogError = Process.StandardError.ReadToEnd(); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + CheckIfServerIsRunning(); + } + } + + private void CheckIfServerIsRunning() + { + var netcat = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = "/bin/netstat", + WorkingDirectory = "/bin/", + Arguments = "-ntpl", + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = true, + } + }; + + netcat.Start(); + netcat.WaitForExit(); + + Console.Out.WriteLine("netstat:"); + Console.Out.WriteLine($"out: {netcat.StandardOutput.ReadToEnd()}"); + Console.Out.WriteLine($"err: {netcat.StandardError.ReadToEnd()}"); } private Server GetServer()