From 82ac9f55f2a252ca9e16e0fc39f62960f33cdf25 Mon Sep 17 00:00:00 2001 From: waldekmastykarz Date: Fri, 8 Nov 2024 17:21:58 +0100 Subject: [PATCH] Updates DevToolsPlugin to not require browser to be closed --- dev-proxy-plugins/Inspection/DevToolsPlugin.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/dev-proxy-plugins/Inspection/DevToolsPlugin.cs b/dev-proxy-plugins/Inspection/DevToolsPlugin.cs index eae8530e..8affbb05 100644 --- a/dev-proxy-plugins/Inspection/DevToolsPlugin.cs +++ b/dev-proxy-plugins/Inspection/DevToolsPlugin.cs @@ -148,23 +148,14 @@ private void InitInspector() return; } - // find if the process is already running - var processes = GetBrowserProcesses(browserPath); - - if (processes.Any()) - { - var ids = string.Join(", ", processes.Select(p => p.Id.ToString())); - Logger.LogError("Found existing browser process {processName} with IDs {processIds}. Could not start {plugin}. Please close existing browser processes and restart Dev Proxy", browserPath, ids, Name); - return; - } - var port = GetFreePort(); webSocket = new WebSocketServer(port, Logger); webSocket.MessageReceived += SocketMessageReceived; _ = webSocket.StartAsync(); var inspectionUrl = $"http://localhost:9222/devtools/inspector.html?ws=localhost:{port}"; - var args = $"{inspectionUrl} --remote-debugging-port=9222 --profile-directory=devproxy"; + var profilePath = Path.Combine(Path.GetTempPath(), "devtools-devproxy"); + var args = $"{inspectionUrl} --remote-debugging-port=9222 --user-data-dir=\"{profilePath}\""; Logger.LogInformation("{name} available at {inspectionUrl}", Name, inspectionUrl);