Skip to content

Commit 5e660a7

Browse files
Updates DevToolsPlugin to not require browser to be closed (#1156)
1 parent 5001dd5 commit 5e660a7

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

dev-proxy-plugins/Inspection/DevToolsPlugin.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,23 +148,14 @@ private void InitInspector()
148148
return;
149149
}
150150

151-
// find if the process is already running
152-
var processes = GetBrowserProcesses(browserPath);
153-
154-
if (processes.Any())
155-
{
156-
var ids = string.Join(", ", processes.Select(p => p.Id.ToString()));
157-
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);
158-
return;
159-
}
160-
161151
var port = GetFreePort();
162152
webSocket = new WebSocketServer(port, Logger);
163153
webSocket.MessageReceived += SocketMessageReceived;
164154
_ = webSocket.StartAsync();
165155

166156
var inspectionUrl = $"http://localhost:9222/devtools/inspector.html?ws=localhost:{port}";
167-
var args = $"{inspectionUrl} --remote-debugging-port=9222 --profile-directory=devproxy";
157+
var profilePath = Path.Combine(Path.GetTempPath(), "devtools-devproxy");
158+
var args = $"{inspectionUrl} --remote-debugging-port=9222 --user-data-dir=\"{profilePath}\"";
168159

169160
Logger.LogInformation("{name} available at {inspectionUrl}", Name, inspectionUrl);
170161

0 commit comments

Comments
 (0)