Use absolute path for unix domain socket in listen mode (#2489)
authorFilip Navara <filip.navara@gmail.com>
Mon, 9 Aug 2021 17:19:18 +0000 (19:19 +0200)
committerGitHub <noreply@github.com>
Mon, 9 Aug 2021 17:19:18 +0000 (10:19 -0700)
src/Tools/Common/ReversedServerHelpers/ReversedServerHelpers.cs

index 71bc1fb793a46066233ca4de3c260db681b2e9c2..506c7ccca96458e408020f9440cec3951c975395 100644 (file)
@@ -182,7 +182,18 @@ namespace Microsoft.Internal.Common.Utils
         private string _toolName;
         private int _timeoutInSec;
 
-        private string GetTransportName(string toolName) => $"{toolName}-{Process.GetCurrentProcess().Id}-{DateTime.Now:yyyyMMdd_HHmmss}.socket";
+        private string GetTransportName(string toolName)
+        {
+            string transportName = $"{toolName}-{Process.GetCurrentProcess().Id}-{DateTime.Now:yyyyMMdd_HHmmss}.socket";
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+            {
+                return transportName;
+            }
+            else
+            {
+                return Path.Combine(Path.GetTempPath(), transportName);
+            }
+        }
 
         public DiagnosticsClientBuilder(string toolName, int timeoutInSec)
         {