From 783bf89241a4724f1a836f240ef00fbbf30e5235 Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Fri, 16 Nov 2018 09:52:48 -0600 Subject: [PATCH] Fix #171 --- GBM/Managers/mgrPath.vb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/GBM/Managers/mgrPath.vb b/GBM/Managers/mgrPath.vb index 340a71f..05bd10c 100644 --- a/GBM/Managers/mgrPath.vb +++ b/GBM/Managers/mgrPath.vb @@ -292,22 +292,14 @@ Public Class mgrPath End Function Public Shared Function GetWinePrefix(ByVal prs As Process) As String - Dim prps As Process - Dim sPsinfo As String - Dim oParse As New Regex("WINEPREFIX=.+?(?= )") + Dim sEnv As String + Dim oParse As New Regex("WINEPREFIX=.+?(?=\x00)") Dim oMatch As Match Try - prps = New Process - prps.StartInfo.FileName = "/bin/ps" - prps.StartInfo.Arguments = "e " & prs.Id.ToString - prps.StartInfo.UseShellExecute = False - prps.StartInfo.RedirectStandardOutput = True - prps.StartInfo.CreateNoWindow = True - prps.Start() - sPsinfo = prps.StandardOutput.ReadToEnd() - If oParse.IsMatch(sPsinfo) Then - oMatch = oParse.Match(sPsinfo) + sEnv = File.ReadAllText("/proc/" & prs.Id.ToString() & "/environ") + If oParse.IsMatch(sEnv) Then + oMatch = oParse.Match(sEnv) Return oMatch.Value.Trim("/").Split("=")(1) Else 'When WINEPREFIX is not part of the command, we will assume the default prefix.