aboutsummaryrefslogtreecommitdiff
path: root/src/profile/browser-process.ts
diff options
context:
space:
mode:
authoramankumarsingh77 <amankumarsingh7702@gmail.com>2026-07-28 20:34:49 +0530
committerAman Kumar <145339995+amankumarsingh77@users.noreply.github.com>2026-08-02 19:12:46 +0530
commita9bdbd8590801cd9c2fa0cda6203948ac19a779c (patch)
tree060ced4709815f9415fc1172842ed25d97de545f /src/profile/browser-process.ts
parent34e5cfdcbe29bbb5f2f46ba54eb67903abd9274d (diff)
refactor: tidy the whitespace the comment removal left behind
Drops leading blank lines where a file header was removed, collapses double blank lines, and closes the empty catch/handler blocks whose only content had been a comment. Whitespace only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/profile/browser-process.ts')
-rw-r--r--src/profile/browser-process.ts22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/profile/browser-process.ts b/src/profile/browser-process.ts
index cbf4d70..3d7bb05 100644
--- a/src/profile/browser-process.ts
+++ b/src/profile/browser-process.ts
@@ -106,7 +106,6 @@ export const parseUserDataDirFlag = (commandLine: string): string | undefined =>
return value && value.length > 0 ? value : undefined;
};
-
const collectLinux = async (): Promise<ReadonlyArray<BrowserCandidate>> => {
let pids: string[];
try {
@@ -135,8 +134,7 @@ const collectLinux = async (): Promise<ReadonlyArray<BrowserCandidate>> => {
let link: string | undefined;
try {
link = await readlink(`/proc/${pid}/exe`);
- } catch {
- }
+ } catch {}
// Chrome rewrites its argv to the bare executable path, so argv[0] is the live install location when /proc/<pid>/exe is unreadable or stale.
const exePath =
(link ? await spawnableExePath(link) : undefined) ??
@@ -150,7 +148,6 @@ const collectLinux = async (): Promise<ReadonlyArray<BrowserCandidate>> => {
return candidates;
};
-
const collectDarwin = async (): Promise<ReadonlyArray<BrowserCandidate>> => {
let lines: string[];
try {
@@ -175,8 +172,7 @@ const collectDarwin = async (): Promise<ReadonlyArray<BrowserCandidate>> => {
try {
const { stdout } = await run("ps", ["-ww", "-o", "args=", "-p", pid], { timeout: EXEC_TIMEOUT_MS });
args = stdout.trim();
- } catch {
- }
+ } catch {}
if (args && hasChildProcessType(args)) continue;
const explicit = args ? parseUserDataDirFlag(args) : undefined;
candidates.push({
@@ -187,7 +183,6 @@ const collectDarwin = async (): Promise<ReadonlyArray<BrowserCandidate>> => {
return candidates;
};
-
const POWERSHELL_QUERY = [
"$ErrorActionPreference='SilentlyContinue';",
"Get-CimInstance Win32_Process",
@@ -232,15 +227,13 @@ const collectWin32 = async (): Promise<ReadonlyArray<BrowserCandidate>> => {
if (candidates.length > 0) return candidates;
}
}
- } catch {
- }
+ } catch {}
try {
const { stdout } = await run("tasklist.exe", [], { timeout: EXEC_TIMEOUT_MS, windowsHide: true });
const lower = stdout.toLowerCase();
if (WIN_IMAGE_NAMES.some((n) => lower.includes(n))) return [{}];
- } catch {
- }
+ } catch {}
return [];
};
@@ -273,14 +266,12 @@ const winRegistryExecutable = async (): Promise<string | undefined> => {
const match = /REG_[A-Z_]+\s+(.+)$/m.exec(stdout.trim());
const path = match?.[1]?.trim();
if (path) return path;
- } catch {
- }
+ } catch {}
}
}
return undefined;
};
-
export const detectRunningBrowser = async (preferUserDataDir?: string): Promise<RunningBrowser> => {
const candidates =
process.platform === "darwin"
@@ -323,8 +314,7 @@ export const resolveBrowserExecutable = async (running?: RunningBrowser): Promis
try {
await access(candidate);
return candidate;
- } catch {
- }
+ } catch {}
}
return undefined;
};