Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

cloudflared: only Strata's own tunnel (same port or same token) blocks a start; other running connectors are listed in plain words with their PID

Niko12216149cec03e4b
diff --git a/apps/host/server/cloudflare.mjs b/apps/host/server/cloudflare.mjs
index 88b047477..ea5a1027a 100644
--- a/apps/host/server/cloudflare.mjs
+++ b/apps/host/server/cloudflare.mjs
@@ -1,7 +1,7 @@
/** A supervised Cloudflare connector with a private, inference-only origin. */
import { spawn } from 'node:child_process';
import { probe, which } from './util.mjs';
-import { describeConnector, runningMessage } from './cloudflared-find.mjs';
+import { classifyRunning, describeConnector, otherTunnelMessage, ownTunnelMessage } from './cloudflared-find.mjs';
export function tunnelHostname(value) {
const hostname = String(value ?? '').trim().toLowerCase();
@@ -13,9 +13,13 @@ export function createCloudflare({ origin, originUrl, hasKey, changed = () => {}
let value = { status: 'idle', mode: null, url: null, error: null };
const state = () => {
const info = binary ? connectorInfo() : null;
- return { ...value, installed: !!binary, originUrl, connector: info ? { path: info.path, version: info.version, source: info.source, label: info.label, summary: describeConnector(info) } : null, external: other?.running ? { kind: other.kind, message: runningMessage(other) } : null };
+ return { ...value, installed: !!binary, originUrl, connector: info ? { path: info.path, version: info.version, source: info.source, label: info.label, summary: describeConnector(info) } : null, external: other?.running ? externalState() : null };
};
const update = patch => { value = { ...value, ...patch }; changed(state()); };
+ function externalState(token = '') {
+ const { own, others } = classifyRunning(other, { originUrl, token });
+ return { kind: other.kind, others, own, message: own.length ? ownTunnelMessage(own) : otherTunnelMessage(others) };
+ }
async function lookForOther() { try { other = await findRunning({ exclude: [child?.pid] }); } catch { other = null; } return other; }
async function inspect() { binary = await locate(); await lookForOther(); changed(state()); return state(); }
async function prepare() {
@@ -59,8 +63,8 @@ export function createCloudflare({ origin, originUrl, hasKey, changed = () => {}
binary = await locate();
if (!binary && prepareConnector) binary = await prepareConnector();
if (!binary) throw new Error('The connector could not be prepared automatically. Retry connector setup.');
- // A cloudflared that is already running here (a system service, or one the person started) is never doubled up.
- if ((await lookForOther())?.running) throw new Error(runningMessage(other));
+ // Strata's own tunnel (same port or same token) is never doubled up. Other cloudflared processes serve other tunnels and are left alone.
+ if ((await lookForOther())?.running) { const { own } = classifyRunning(other, { originUrl, token }); if (own.length) throw new Error(ownTunnelMessage(own)); }
await origin.start();
// Tokens never appear in command arguments, logs, saved settings, or API responses.
const env = { ...process.env };
diff --git a/apps/host/server/cloudflared-find.mjs b/apps/host/server/cloudflared-find.mjs
index ef639624e..cd0760477 100644
--- a/apps/host/server/cloudflared-find.mjs
+++ b/apps/host/server/cloudflared-find.mjs
@@ -125,22 +125,27 @@ export function skippedMessage(skipped) {
}
/**
- * Is another cloudflared already running on this computer (a system service, or one the person started)?
- * `exclude` is the list of pids that belong to Strata itself. Resolves to { running, kind: 'service' | 'process' | null, pids }.
- * Failing to look is "not running": a missing pgrep must never block the tunnel.
+ * Which cloudflared processes run on this computer (a system service, one the person started, another program's tunnel)?
+ * `exclude` is the list of pids that belong to Strata itself. Resolves to { running, kind: 'service' | 'process' | null, pids, procs }
+ * where procs is [{ pid, command }] (the command line is for matching only: it can hold a tunnel token and is never shown).
+ * Failing to look is "not running": a missing ps must never block the tunnel.
*/
export async function findRunningConnector({ platform = process.platform, exclude = [], run = defaultProbe } = {}) {
const skip = new Set(exclude.filter(Number.isInteger));
- let pids = [];
+ let procs = [];
if (platform === 'win32') {
- const out = await run('tasklist', ['/FI', 'IMAGENAME eq cloudflared.exe', '/NH', '/FO', 'CSV']);
- pids = [...out.matchAll(/"cloudflared\.exe","(\d+)"/gi)].map(m => Number(m[1]));
+ const out = await run('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', "Get-CimInstance Win32_Process -Filter \"Name='cloudflared.exe'\" | ForEach-Object { \"$($_.ProcessId)`t$($_.CommandLine)\" }"]);
+ procs = out.split(/\r?\n/).map(l => /^(\d+)\t(.*)$/.exec(l)).filter(Boolean).map(m => ({ pid: Number(m[1]), command: m[2] }));
+ if (!procs.length) { // no PowerShell answer: at least the pids
+ const list = await run('tasklist', ['/FI', 'IMAGENAME eq cloudflared.exe', '/NH', '/FO', 'CSV']);
+ procs = [...list.matchAll(/"cloudflared\.exe","(\d+)"/gi)].map(m => ({ pid: Number(m[1]), command: '' }));
+ }
} else {
- const out = await run('pgrep', ['-x', 'cloudflared']);
- pids = out.split(/\s+/).filter(Boolean).map(Number).filter(Number.isInteger);
+ const out = await run('ps', ['-axo', 'pid=,comm=,args=']);
+ procs = out.split('\n').map(l => /^\s*(\d+)\s+(\S+)\s*(.*)$/.exec(l)).filter(m => m && /(^|\/)cloudflared$/.test(m[2])).map(m => ({ pid: Number(m[1]), command: m[3] }));
}
- pids = pids.filter(pid => !skip.has(pid));
- if (!pids.length) return { running: false, kind: null, pids: [] };
+ procs = procs.filter(p => !skip.has(p.pid));
+ if (!procs.length) return { running: false, kind: null, pids: [], procs: [] };
let kind = 'process';
if (platform === 'linux') {
const active = (await run('systemctl', ['is-active', 'cloudflared'])).trim();
@@ -149,7 +154,35 @@ export async function findRunningConnector({ platform = process.platform, exclud
const service = await run('sc.exe', ['query', 'Cloudflared']);
if (/RUNNING/.test(service)) kind = 'service';
}
- return { running: true, kind, pids };
+ return { running: true, kind, pids: procs.map(p => p.pid), procs };
+}
+
+/**
+ * Split the running connectors into Strata's own tunnel (same port: its command line has --url pointing at `originUrl`'s port; same tunnel:
+ * its command line holds the same token) and tunnels of something else, which are none of Strata's business.
+ */
+export function classifyRunning(running, { originUrl = '', token = '' } = {}) {
+ const port = /:(\d+)\/?$/.exec(String(originUrl))?.[1] ?? null;
+ const own = [], others = [];
+ for (const p of running?.procs ?? []) {
+ const cmd = p.command ?? '';
+ const samePort = !!port && new RegExp(`--url[= ]\\S*:${port}(?:/|\\s|$)`).test(cmd);
+ const sameToken = token.length >= 20 && cmd.includes(token);
+ (samePort || sameToken ? own : others).push(p.pid);
+ }
+ return { own, others };
+}
+
+const pidList = pids => pids.join(', ');
+/** Plain sentence about tunnels that are none of Strata's business (information only, never a refusal). */
+export function otherTunnelMessage(pids) {
+ if (!pids?.length) return null;
+ return pids.length === 1 ? `cloudflared is already running for another tunnel (PID ${pids[0]}).` : `cloudflared is already running for other tunnels (PIDs ${pidList(pids)}).`;
+}
+/** The refusal for Strata's own tunnel already running. */
+export function ownTunnelMessage(pids) {
+ if (!pids?.length) return null;
+ return `Strata’s tunnel for this address is already running (PID ${pidList(pids)}), so Strata did not start a second one. Stop it first (or use it as it is), then connect again here.`;
}
function defaultProbe(cmd, args) {
@@ -157,11 +190,3 @@ function defaultProbe(cmd, args) {
execFile(cmd, args, { timeout: 4000, windowsHide: true, maxBuffer: 1024 * 1024 }, (error, stdout) => resolve(error ? '' : String(stdout)));
});
}
-
-/** The plain sentence for a connector that is already running, with the one next step. */
-export function runningMessage(running) {
- if (!running?.running) return null;
- return running.kind === 'service'
- ? 'Cloudflare’s connector is already running on this computer as a system service, so Strata did not start a second one. Stop that service first (or use its tunnel as it is), then connect again here.'
- : 'Cloudflare’s connector (cloudflared) is already running on this computer, so Strata did not start a second one. Close it first (or use its tunnel as it is), then connect again here.';
-}
diff --git a/apps/host/src/components/CloudflareDialog.tsx b/apps/host/src/components/CloudflareDialog.tsx
index 90d96d8eb..9fe60a539 100644
--- a/apps/host/src/components/CloudflareDialog.tsx
+++ b/apps/host/src/components/CloudflareDialog.tsx
@@ -19,7 +19,7 @@ export function CloudflareDialog({ open, onClose, onCreateKey }: {
const steps = mode === 'quick' ? ['Address', 'Connector', 'API key', 'Connect'] : ['Address', 'Connector', 'API key', 'Domain', 'Connect'];
const last = steps.length - 1;
const installed = !!tunnel?.installed, keyReady = !!serving?.access.apiKeySet, other = tunnel?.external ?? null;
- const canContinue = step === 1 ? installed && !other : step === 2 ? keyReady : step === 3 && mode === 'domain' ? !!hostname.trim() && !!token.trim() : true;
+ const canContinue = step === 1 ? installed : step === 2 ? keyReady : step === 3 && mode === 'domain' ? !!hostname.trim() && !!token.trim() : true;
async function inspect() { setPending(true); setError(''); try {
setDetected(await api.get<TunnelState>('/api/serving/tunnel'));
}
@@ -91,7 +91,7 @@ export function CloudflareDialog({ open, onClose, onCreateKey }: {
setMode(mode === 'quick' ? 'domain' : 'quick');
(e.currentTarget.parentElement?.children[mode === 'quick' ? 1 : 0] as HTMLElement)?.focus();
} }} onClick={() => setMode(choice.value)}><Icon name={choice.icon} size={20}/><span><strong>{tr(choice.title)}</strong><small>{tr(choice.detail)}</small></span><span className="tunnel-choice-dot">{tr(mode === choice.value ? <Icon name="check" size={13}/> : null)}</span></button>))}</div></> : null)}
- {tr(step === 1 ? <div className="tunnel-automatic" data-ready={installed || undefined} aria-live="polite" aria-busy={pending}><span className="tunnel-stage__symbol"><Icon name={installed ? 'check' : error ? 'warning' : 'refresh'} size={28}/></span><p className="small muted">{tr(installed ? 'Your Cloudflare connector is installed and ready.' : error ? 'Automatic setup needs another try.' : 'Strata downloads and sets up the Cloudflare connector for you.')}</p>{tr(installed ? <>{tr(tunnel?.connector ? <p className="xs muted">{tr("Using {0}", [tunnel.connector.summary])}</p> : null)}{tr(other ? <><p className="small" role="status">{tr(other.message)}</p><Btn disabled={pending} onClick={() => void inspect()}>{tr("Check again")}</Btn></> : null)}</> : error ? <Btn onClick={() => setRetry(v => v + 1)}>{tr("Retry setup")}</Btn> : <span className="small muted" role="status">{tr("Setting up\u2026")}</span>)}</div> : null)}
+ {tr(step === 1 ? <div className="tunnel-automatic" data-ready={installed || undefined} aria-live="polite" aria-busy={pending}><span className="tunnel-stage__symbol"><Icon name={installed ? 'check' : error ? 'warning' : 'refresh'} size={28}/></span><p className="small muted">{tr(installed ? 'Your Cloudflare connector is installed and ready.' : error ? 'Automatic setup needs another try.' : 'Strata downloads and sets up the Cloudflare connector for you.')}</p>{tr(installed ? <>{tr(tunnel?.connector ? <p className="xs muted">{tr("Using {0}", [tunnel.connector.summary])}</p> : null)}{tr(other ? <p className="xs muted" role="status">{tr(other.others.length === 1 && !other.own.length ? "cloudflared is already running for another tunnel (PID {0})." : other.own.length ? "Strata’s tunnel for this address is already running (PID {0})." : "cloudflared is already running for other tunnels (PIDs {0}).", [(other.own.length ? other.own : other.others).join(", ")])}</p> : null)}</> : error ? <Btn onClick={() => setRetry(v => v + 1)}>{tr("Retry setup")}</Btn> : <span className="small muted" role="status">{tr("Setting up\u2026")}</span>)}</div> : null)}
{tr(step === 2 ? <><p className="small muted">{tr("Only apps with your Strata API key can use this connection.")}</p>{tr(keyReady ? <div className="tunnel-check"><Icon name="shield"/><div><strong>{tr("API key ready")}</strong><span>{tr("Use your existing key in the app you connect.")}</span></div></div> : <div className="tunnel-key-step"><Icon name="shield" size={30}/><p className="small">{tr("Create a key to protect your API. You\u2019ll return here when it\u2019s ready.")}</p><Btn onClick={onCreateKey}>{tr("Create an API key")}</Btn></div>)}</> : null)}
{tr(mode === 'domain' && step === 3 ? <><p className="small muted">{tr("Create a tunnel in your ")}<a href="https://dash.cloudflare.com/" target="_blank" rel="noreferrer">{tr("Cloudflare dashboard \u2197")}</a>{tr(". Copy the token from its connector setup.")}</p><label className="input-field"><span>{tr("Tunnel token")}</span><input type="password" className="st-input" autoComplete="off" spellCheck={false} value={token} onChange={e => setToken(e.target.value)} placeholder={tr("Paste only the token after --token")}/></label><label className="input-field"><span>{tr("Your hostname")}</span><input className="st-input" autoComplete="off" spellCheck={false} value={hostname} onChange={e => setHostname(e.target.value)} placeholder={tr("ai.example.com")}/></label><div><p className="small muted">{tr("Add a published application route for this hostname with this service URL:")}</p><div className="install-command"><code>{tunnel?.originUrl ?? 'Loading…'}</code><IconBtn name="copy" title={tr("Copy tunnel service URL")} disabled={!tunnel?.originUrl} onClick={() => void navigator.clipboard.writeText(tunnel!.originUrl)}/></div></div><p className="xs muted">{tr("The token is used for this connection only and is not saved.")}</p></> : null)}
{tr(step === last ? <><p className="small muted">{tr(mode === 'quick' ? 'Cloudflare will create your address when you connect.' : 'Start the connector for the domain you configured.')}</p><dl className="tunnel-review"><div><dt>{tr("Address")}</dt><dd>{tr(mode === 'quick' ? 'Free temporary URL' : hostname)}</dd></div><div><dt>{tr("Connector")}</dt><dd><Icon name="check" size={14}/>{tr(tunnel?.connector?.version ? "Installed · cloudflared {0}" : "Installed", tunnel?.connector?.version ? [tunnel.connector.version] : undefined)}</dd></div><div><dt>{tr("Access")}</dt><dd><Icon name="shield" size={14}/>{tr("API key required")}</dd></div></dl><p className="small muted">{tr(mode === 'quick' ? 'The address changes each time. Turn off streaming in your client; replies arrive all at once.' : 'Use this hostname and your Strata API key in your client. Streaming is supported.')}</p><p className="xs muted">{tr("Only the inference API is shared. Your computer and Strata must stay on.")}</p></> : null)}
diff --git a/apps/host/src/lib/plain-errors.ts b/apps/host/src/lib/plain-errors.ts
index 77e693902..e505805b1 100644
--- a/apps/host/src/lib/plain-errors.ts
+++ b/apps/host/src/lib/plain-errors.ts
@@ -15,6 +15,7 @@ const MEMORY_NEXT = 'Close other programs and try again, or choose “Leave 20%
/** Order matters: the first rule that matches wins. */
const RULES: Rule[] = [
+ { kind: 'tunnel-own-running', match: /Strata’s tunnel for this address is already running \(PID/i, message: 'Strata’s tunnel for this address is already running.', next: 'Stop it first, or use it as it is, then connect again here.' },
{ kind: 'gpu-shared', match: /GPU \d+ is already used by .*, so this model did not fit there/i, message: 'Another model on the same graphics card left no room for this one.', next: 'Load it on a different GPU, or unload the other model first.' },
{ kind: 'engine-too-old', match: /needs a newer engine: .* needs engine/i, message: 'This model needs a newer engine.', next: 'Update the engine (Settings, Engine, Update engine), then try again.' },
{ kind: 'settings-file', match: /settings file for this model has a mistake/i, message: 'Your settings file has a mistake, so the model was not started.', next: 'Open the settings file under Expert settings, fix the line shown under Details, then load the model again.' },
diff --git a/apps/host/src/lib/types.ts b/apps/host/src/lib/types.ts
index 0297135fd..dafb90add 100644
--- a/apps/host/src/lib/types.ts
+++ b/apps/host/src/lib/types.ts
@@ -223,7 +223,7 @@ export interface ServeRequest {
finishReason?: string | null;
}
-export interface TunnelState { status: 'idle' | 'starting' | 'connected' | 'stopping' | 'error'; mode: 'quick' | 'domain' | null; url: string | null; error: string | null; installed: boolean; originUrl: string; connector?: { path: string; version: string | null; source: string; label: string; summary: string } | null; external?: { kind: 'service' | 'process'; message: string } | null; }
+export interface TunnelState { status: 'idle' | 'starting' | 'connected' | 'stopping' | 'error'; mode: 'quick' | 'domain' | null; url: string | null; error: string | null; installed: boolean; originUrl: string; connector?: { path: string; version: string | null; source: string; label: string; summary: string } | null; external?: { kind: 'service' | 'process'; others: number[]; own: number[]; message: string } | null; }
export interface ServingState {
tunnel?: TunnelState;
diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.json
index 7be6ca326..488056543 100644
--- a/apps/host/src/locales/de.json
+++ b/apps/host/src/locales/de.json
@@ -3192,5 +3192,10 @@
"s3196": "Bereits von {0} belegt",
"s3197": "Beende den Chat, der dieses Modell noch verwendet, oder beantworte seine Rückfrage, und versuche es dann erneut.",
"s3198": "Ein anderes Modell auf derselben Grafikkarte hat für dieses keinen Platz gelassen.",
- "s3199": "Lade es auf einer anderen GPU oder entlade zuerst das andere Modell."
+ "s3199": "Lade es auf einer anderen GPU oder entlade zuerst das andere Modell.",
+ "s3200": "cloudflared läuft bereits für einen anderen Tunnel (PID {0}).",
+ "s3201": "cloudflared läuft bereits für andere Tunnel (PIDs {0}).",
+ "s3202": "Der Strata-Tunnel für diese Adresse läuft bereits (PID {0}).",
+ "s3203": "Der Strata-Tunnel für diese Adresse läuft bereits.",
+ "s3204": "Beende ihn zuerst oder nutze ihn, wie er ist, und verbinde dich dann hier erneut."
}
diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.json
index 1dd02cab4..213db3c79 100644
--- a/apps/host/src/locales/en.json
+++ b/apps/host/src/locales/en.json
@@ -3192,5 +3192,10 @@
"s3196": "Already used by {0}",
"s3197": "Stop or answer the chat that is still using this model, then try again.",
"s3198": "Another model on the same graphics card left no room for this one.",
- "s3199": "Load it on a different GPU, or unload the other model first."
+ "s3199": "Load it on a different GPU, or unload the other model first.",
+ "s3200": "cloudflared is already running for another tunnel (PID {0}).",
+ "s3201": "cloudflared is already running for other tunnels (PIDs {0}).",
+ "s3202": "Strata’s tunnel for this address is already running (PID {0}).",
+ "s3203": "Strata’s tunnel for this address is already running.",
+ "s3204": "Stop it first, or use it as it is, then connect again here."
}
diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.json
index b9385490c..ec551558e 100644
--- a/apps/host/src/locales/es.json
+++ b/apps/host/src/locales/es.json
@@ -3192,5 +3192,10 @@
"s3196": "Ya lo usa {0}",
"s3197": "Detén el chat que sigue usando este modelo, o responde a su pregunta pendiente, y vuelve a intentarlo.",
"s3198": "Otro modelo en la misma tarjeta gráfica no dejó espacio para este.",
- "s3199": "Cárgalo en otra GPU, o descarga primero el otro modelo."
+ "s3199": "Cárgalo en otra GPU, o descarga primero el otro modelo.",
+ "s3200": "cloudflared ya se está ejecutando para otro túnel (PID {0}).",
+ "s3201": "cloudflared ya se está ejecutando para otros túneles (PID {0}).",
+ "s3202": "El túnel de Strata para esta dirección ya se está ejecutando (PID {0}).",
+ "s3203": "El túnel de Strata para esta dirección ya se está ejecutando.",
+ "s3204": "Deténlo primero, o úsalo tal como está, y vuelve a conectar aquí."
}
diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.json
index f05bf80d4..4373f3dfe 100644
--- a/apps/host/src/locales/ja.json
+++ b/apps/host/src/locales/ja.json
@@ -3192,5 +3192,10 @@
"s3196": "{0} がすでに使用中",
"s3197": "このモデルをまだ使っているチャットを停止するか、その確認に答えてから、もう一度お試しください。",
"s3198": "同じグラフィックスカード上の別のモデルが、このモデルの分の空きを残しませんでした。",
- "s3199": "別のGPUに読み込むか、先にもう一方のモデルをアンロードしてください。"
+ "s3199": "別のGPUに読み込むか、先にもう一方のモデルをアンロードしてください。",
+ "s3200": "cloudflared は別のトンネル用にすでに動作しています(PID {0})。",
+ "s3201": "cloudflared は他のトンネル用にすでに動作しています(PID {0})。",
+ "s3202": "このアドレス用のStrataのトンネルはすでに動作しています(PID {0})。",
+ "s3203": "このアドレス用のStrataのトンネルはすでに動作しています。",
+ "s3204": "先にそれを停止するか、そのまま使ってから、ここで再度接続してください。"
}
diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.json
index 50edd28f2..206d11c08 100644
--- a/apps/host/src/locales/ko.json
+++ b/apps/host/src/locales/ko.json
@@ -3192,5 +3192,10 @@
"s3196": "이미 {0}에서 사용 중",
"s3197": "이 모델을 아직 사용 중인 채팅을 중지하거나 대기 중인 질문에 답한 뒤 다시 시도하세요.",
"s3198": "같은 그래픽 카드의 다른 모델이 이 모델을 위한 공간을 남기지 않았습니다.",
- "s3199": "다른 GPU에 불러오거나 먼저 다른 모델을 언로드하세요."
+ "s3199": "다른 GPU에 불러오거나 먼저 다른 모델을 언로드하세요.",
+ "s3200": "cloudflared가 이미 다른 터널용으로 실행 중입니다(PID {0}).",
+ "s3201": "cloudflared가 이미 다른 터널용으로 실행 중입니다(PID {0}).",
+ "s3202": "이 주소용 Strata 터널이 이미 실행 중입니다(PID {0}).",
+ "s3203": "이 주소용 Strata 터널이 이미 실행 중입니다.",
+ "s3204": "먼저 중지하거나 그대로 사용한 뒤 여기서 다시 연결하세요."
}
diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.json
index 33e4c618a..cf10edee4 100644
--- a/apps/host/src/locales/pt.json
+++ b/apps/host/src/locales/pt.json
@@ -3192,5 +3192,10 @@
"s3196": "Já em uso por {0}",
"s3197": "Pare o chat que ainda usa este modelo, ou responda à pergunta pendente dele, e tente novamente.",
"s3198": "Outro modelo na mesma placa de vídeo não deixou espaço para este.",
- "s3199": "Carregue-o em outra GPU ou descarregue primeiro o outro modelo."
+ "s3199": "Carregue-o em outra GPU ou descarregue primeiro o outro modelo.",
+ "s3200": "O cloudflared já está em execução para outro túnel (PID {0}).",
+ "s3201": "O cloudflared já está em execução para outros túneis (PIDs {0}).",
+ "s3202": "O túnel do Strata para este endereço já está em execução (PID {0}).",
+ "s3203": "O túnel do Strata para este endereço já está em execução.",
+ "s3204": "Pare-o primeiro, ou use-o como está, e conecte novamente aqui."
}
diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.json
index 2ff2b1224..194ff4cd0 100644
--- a/apps/host/src/locales/ru.json
+++ b/apps/host/src/locales/ru.json
@@ -3192,5 +3192,10 @@
"s3196": "Уже занята: {0}",
"s3197": "Остановите чат, который всё ещё использует эту модель, или ответьте на его запрос, затем повторите попытку.",
"s3198": "Другая модель на той же видеокарте не оставила места для этой.",
- "s3199": "Загрузите её на другую видеокарту или сначала выгрузите другую модель."
+ "s3199": "Загрузите её на другую видеокарту или сначала выгрузите другую модель.",
+ "s3200": "cloudflared уже запущен для другого туннеля (PID {0}).",
+ "s3201": "cloudflared уже запущен для других туннелей (PID {0}).",
+ "s3202": "Туннель Strata для этого адреса уже запущен (PID {0}).",
+ "s3203": "Туннель Strata для этого адреса уже запущен.",
+ "s3204": "Сначала остановите его или используйте как есть, затем подключитесь здесь снова."
}
diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.json
index 597c39e85..86ef6fa18 100644
--- a/apps/host/src/locales/zh.json
+++ b/apps/host/src/locales/zh.json
@@ -3192,5 +3192,10 @@
"s3196": "已被 {0} 占用",
"s3197": "请停止仍在使用此模型的聊天,或回答它等待的确认,然后重试。",
"s3198": "同一块显卡上的另一个模型没有给这个模型留出空间。",
- "s3199": "请将它加载到另一块 GPU 上,或先卸载另一个模型。"
+ "s3199": "请将它加载到另一块 GPU 上,或先卸载另一个模型。",
+ "s3200": "cloudflared 已在为另一个隧道运行(PID {0})。",
+ "s3201": "cloudflared 已在为其他隧道运行(PID {0})。",
+ "s3202": "这个地址的 Strata 隧道已在运行(PID {0})。",
+ "s3203": "这个地址的 Strata 隧道已在运行。",
+ "s3204": "请先停止它,或直接使用它,然后在这里重新连接。"
}
diff --git a/apps/host/tests/cloudflared-find.test.mjs b/apps/host/tests/cloudflared-find.test.mjs
index c59255035..07dcbb502 100644
--- a/apps/host/tests/cloudflared-find.test.mjs
+++ b/apps/host/tests/cloudflared-find.test.mjs
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import { chmod, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
-import { connectorCandidates, describeConnector, findConnector, findRunningConnector, MIN_VERSION, parseVersion, runningMessage, skippedMessage, versionAtLeast } from '../server/cloudflared-find.mjs';
+import { connectorCandidates, describeConnector, findConnector, classifyRunning, findRunningConnector, MIN_VERSION, otherTunnelMessage, ownTunnelMessage, parseVersion, skippedMessage, versionAtLeast } from '../server/cloudflared-find.mjs';
import { createConnectorInstaller } from '../server/cloudflared-install.mjs';
import { createCloudflare } from '../server/cloudflare.mjs';
@@ -81,45 +81,77 @@ test('a real executable on PATH is found and run (a user-local copy, never a sys
} finally { await rm(dir, { recursive: true, force: true }); }
});
-test('running detection: our own pid is ignored; a system service is called a service; failing to look is not a block', async () => {
- const run = async (cmd, args) => cmd === 'pgrep' ? '4242\n77\n' : cmd === 'systemctl' ? 'active\n' : '';
- assert.deepEqual(await findRunningConnector({ platform: 'linux', run }), { running: true, kind: 'service', pids: [4242, 77] });
- assert.deepEqual(await findRunningConnector({ platform: 'linux', run, exclude: [4242, 77] }), { running: false, kind: null, pids: [] });
- const user = async cmd => cmd === 'pgrep' ? '9\n' : 'inactive\n';
- assert.equal((await findRunningConnector({ platform: 'linux', run: user })).kind, 'process');
- assert.equal((await findRunningConnector({ platform: 'darwin', run: user })).kind, 'process');
+const ps = lines => async (cmd) => cmd === 'ps' ? lines.join('\n') + '\n' : cmd === 'systemctl' ? 'active\n' : '';
+
+test('running detection lists every cloudflared with its pid; our own child is ignored; a missing ps is not a block', async () => {
+ const run = ps([' 4242 cloudflared /usr/bin/cloudflared --no-autoupdate tunnel run --token SECRETSECRETSECRETSECRET', ' 77 cloudflared cloudflared tunnel --url http://127.0.0.1:9000', ' 90 bash bash -c cloudflared', ' 100 sshd sshd']);
+ const r = await findRunningConnector({ platform: 'linux', run });
+ assert.deepEqual([r.running, r.kind, r.pids], [true, 'service', [4242, 77]]);
+ assert.equal((await findRunningConnector({ platform: 'linux', run, exclude: [4242, 77] })).running, false);
+ assert.equal((await findRunningConnector({ platform: 'darwin', run: async () => ' 9 cloudflared cloudflared tunnel --url http://127.0.0.1:1\n' })).kind, 'process');
assert.equal((await findRunningConnector({ platform: 'linux', run: async () => '' })).running, false);
- const win = async cmd => cmd === 'tasklist' ? '"cloudflared.exe","8864","Console","1","28,756 K"\r\n' : 'STATE : 4 RUNNING';
- assert.deepEqual(await findRunningConnector({ platform: 'win32', run: win }), { running: true, kind: 'service', pids: [8864] });
- assert.match(runningMessage({ running: true, kind: 'service' }), /already running on this computer as a system service, so Strata did not start a second one/);
- assert.equal(runningMessage({ running: false }), null);
+ const win = async cmd => cmd === 'powershell.exe' ? '8864\tC:\\x\\cloudflared.exe tunnel run --token ABCDEFGHIJKLMNOPQRSTUV\r\n' : 'STATE : 4 RUNNING';
+ const w = await findRunningConnector({ platform: 'win32', run: win });
+ assert.deepEqual([w.running, w.kind, w.pids], [true, 'service', [8864]]);
+});
+
+test('only a tunnel that is clearly Strata’s own (same port, or same token) counts as Strata’s; the rest are other people’s', () => {
+ const running = { running: true, procs: [
+ { pid: 1, command: 'cloudflared tunnel --no-autoupdate --url http://127.0.0.1:8793' },
+ { pid: 2, command: 'cloudflared tunnel --url http://127.0.0.1:18793' },
+ { pid: 3, command: 'cloudflared tunnel run --token TOKENTOKENTOKENTOKENTOKEN' },
+ { pid: 4, command: 'cloudflared tunnel --url=http://localhost:8793/' },
+ { pid: 5, command: '' }] };
+ assert.deepEqual(classifyRunning(running, { originUrl: 'http://127.0.0.1:8793' }), { own: [1, 4], others: [2, 3, 5] });
+ assert.deepEqual(classifyRunning(running, { originUrl: 'http://127.0.0.1:8793', token: 'TOKENTOKENTOKENTOKENTOKEN' }), { own: [1, 3, 4], others: [2, 5] });
+ assert.deepEqual(classifyRunning(running, { originUrl: 'http://127.0.0.1:8793', token: 'short' }), { own: [1, 4], others: [2, 3, 5] }, 'a short string is not a token');
+ assert.equal(otherTunnelMessage([4242]), 'cloudflared is already running for another tunnel (PID 4242).');
+ assert.equal(otherTunnelMessage([1, 2]), 'cloudflared is already running for other tunnels (PIDs 1, 2).');
+ assert.equal(otherTunnelMessage([]), null);
+ assert.match(ownTunnelMessage([7]), /Strata’s tunnel for this address is already running \(PID 7\), so Strata did not start a second one/);
});
function fakeOrigin() { return { started: 0, async start() { this.started++; }, async stop() {} }; }
+const info = () => ({ path: '/usr/bin/cloudflared', version: '2026.5.0', source: 'path', label: 'found on your PATH' });
+const fake = () => ({ stdout: { on() {} }, stderr: { on() {} }, once() {}, kill() {}, pid: 55 });
+const mk = (originUrl, procs, launch, origin = fakeOrigin()) => createCloudflare({ origin, originUrl, hasKey: () => true, locate: async () => '/usr/bin/cloudflared', connectorInfo: info,
+ findRunning: async () => procs.length ? { running: true, kind: 'process', pids: procs.map(p => p.pid), procs } : { running: false, kind: null, pids: [], procs: [] }, launch, timeoutMs: 50 });
-test('the tunnel does not start a second connector next to a running one, and says so plainly', async () => {
- const origin = fakeOrigin(); let launched = 0;
- const cf = createCloudflare({ origin, originUrl: 'http://127.0.0.1:1', hasKey: () => true, locate: async () => '/usr/bin/cloudflared',
- connectorInfo: () => ({ path: '/usr/bin/cloudflared', version: '2026.5.0', source: 'path', label: 'found on your PATH' }),
- findRunning: async () => ({ running: true, kind: 'service', pids: [12] }), launch: () => { launched++; throw new Error('must not launch'); } });
+test('another tunnel running (a service for something else) is listed in plain words and a quick tunnel still starts', async () => {
+ const origin = fakeOrigin(); const spawned = [];
+ const cf = mk('http://127.0.0.1:8793', [{ pid: 12, command: 'cloudflared tunnel run --token SECRETSECRETSECRETSECRET' }], (bin, args) => { spawned.push([bin, args]); return fake(); }, origin);
const seen = await cf.inspect();
- assert.equal(seen.installed, true);
assert.equal(seen.connector.version, '2026.5.0');
- assert.match(seen.connector.summary, /cloudflared 2026\.5\.0 · \/usr\/bin\/cloudflared/);
- assert.equal(seen.external.kind, 'service');
- await assert.rejects(cf.start({ mode: 'quick' }), /already running on this computer as a system service/);
+ assert.deepEqual([seen.external.others, seen.external.own], [[12], []]);
+ assert.equal(seen.external.message, 'cloudflared is already running for another tunnel (PID 12).');
+ assert.ok(!JSON.stringify(seen).includes('SECRETSECRET'), 'a token in another connector’s command line is never in the state');
+ await cf.start({ mode: 'quick' });
+ assert.equal(spawned.length, 1);
+ assert.equal(origin.started, 1);
+ await cf.stop();
+});
+
+test('Strata’s own tunnel (same port) already running is not doubled; the same token is the same tunnel; another token is not', async () => {
+ const origin = fakeOrigin(); let launched = 0;
+ const same = mk('http://127.0.0.1:8793', [{ pid: 31, command: 'cloudflared tunnel --no-autoupdate --url http://127.0.0.1:8793' }], () => { launched++; return fake(); }, origin);
+ assert.deepEqual((await same.inspect()).external.own, [31]);
+ await assert.rejects(same.start({ mode: 'quick' }), /Strata’s tunnel for this address is already running \(PID 31\), so Strata did not start a second one/);
assert.equal(launched, 0);
assert.equal(origin.started, 0, 'the private origin is not opened either');
- assert.equal(cf.state().status, 'error');
+ const token = 'A'.repeat(30);
+ const sameToken = mk('http://127.0.0.1:8793', [{ pid: 32, command: `cloudflared tunnel run --token ${token}` }], () => { launched++; return fake(); }, origin);
+ await assert.rejects(sameToken.start({ mode: 'domain', hostname: 'ai.example.com', token }), /already running \(PID 32\)/);
+ assert.equal(launched, 0);
+ const spawned = [];
+ const other = mk('http://127.0.0.1:8793', [{ pid: 33, command: 'cloudflared tunnel run --token ' + 'B'.repeat(30) }], () => { spawned.push(1); return fake(); }, origin);
+ await other.start({ mode: 'domain', hostname: 'ai.example.com', token });
+ assert.equal(spawned.length, 1, 'a different tunnel token is somebody else’s tunnel');
+ await other.stop();
});
test('with nothing else running the tunnel starts as before and the state names the connector in use', async () => {
- const origin = fakeOrigin(); const spawned = [];
- const fake = { stdout: { on() {} }, stderr: { on() {} }, once() {}, kill() {}, pid: 55 };
- const cf = createCloudflare({ origin, originUrl: 'http://127.0.0.1:1', hasKey: () => true, locate: async () => '/usr/bin/cloudflared',
- connectorInfo: () => ({ path: '/usr/bin/cloudflared', version: '2026.5.0', source: 'path', label: 'found on your PATH' }),
- findRunning: async ({ exclude }) => { assert.ok(Array.isArray(exclude)); return { running: false, kind: null, pids: [] }; },
- launch: (bin, args) => { spawned.push([bin, args]); return fake; }, timeoutMs: 50 });
+ const spawned = [];
+ const cf = mk('http://127.0.0.1:1', [], (bin, args) => { spawned.push([bin, args]); return fake(); });
await cf.start({ mode: 'quick' });
assert.equal(spawned[0][0], '/usr/bin/cloudflared');
assert.equal(cf.state().external, null);
diff --git a/apps/host/tests/plain-errors.test.mjs b/apps/host/tests/plain-errors.test.mjs
index f166d959c..7802d347a 100644
--- a/apps/host/tests/plain-errors.test.mjs
+++ b/apps/host/tests/plain-errors.test.mjs
@@ -9,6 +9,7 @@ const built = await build({ stdin: { contents: "export * from './src/lib/plain-e
const { plainFailure, plainFailureText, setTranslationLanguage } = await import(`data:text/javascript;base64,${Buffer.from(built.outputFiles[0].text).toString('base64')}`);
const cases = [
+ ['Strata’s tunnel for this address is already running (PID 31), so Strata did not start a second one. Stop it first (or use it as it is), then connect again here.', 'tunnel-own-running', /tunnel for this address is already running/],
['GPU 2 is already used by qwen3.8-flash-next-q2_0, so this model did not fit there. Load it on another GPU, or unload qwen3.8-flash-next-q2_0 first.', 'gpu-shared', /no room for this one/],
['This model needs a newer engine: Gyro-S needs engine 0.1.45.1 or newer, and this one is 0.1.45. Update the engine in Settings, then try again.', 'engine-too-old', /needs a newer engine/],
['The settings file for this model has a mistake, so the model was not started. Line 4: The settings file is not valid JSON; look near line 4.', 'settings-file', /settings file has a mistake/],
diff --git a/strata_cli/launch/access.py b/strata_cli/launch/access.py
index 05a108a77..5c8598ebf 100644
--- a/strata_cli/launch/access.py
+++ b/strata_cli/launch/access.py
@@ -137,28 +137,39 @@ def find_cloudflared() -> str | None:
return info["path"] if info else None
-def cloudflared_running(exclude: tuple[int, ...] = ()) -> str | None:
- """'service' or 'process' when a cloudflared that is not in `exclude` already runs on this computer, else None."""
+def cloudflared_procs(exclude: tuple[int, ...] = ()) -> list[tuple[int, str]]:
+ """Every cloudflared running on this computer as (pid, command line), without the pids in `exclude`. The command line is for
+ matching only (it can hold a tunnel token) and is never shown. A failed look is an empty list: it never blocks a tunnel."""
+ out: list[tuple[int, str]] = []
try:
if WINDOWS:
- out = subprocess.run(["tasklist", "/FI", "IMAGENAME eq cloudflared.exe", "/NH", "/FO", "CSV"], capture_output=True,
- text=True, timeout=5, creationflags=subprocess.CREATE_NO_WINDOW).stdout
- pids = [int(p) for p in re.findall(r'"cloudflared\.exe","(\d+)"', out, re.I)]
+ text = subprocess.run(["powershell.exe", "-NoProfile", "-NonInteractive", "-Command",
+ "Get-CimInstance Win32_Process -Filter \"Name='cloudflared.exe'\" | ForEach-Object { \"$($_.ProcessId)`t$($_.CommandLine)\" }"],
+ capture_output=True, text=True, timeout=15, creationflags=subprocess.CREATE_NO_WINDOW).stdout
+ for line in text.splitlines():
+ m = re.match(r"(\d+)\t(.*)$", line)
+ if m:
+ out.append((int(m.group(1)), m.group(2)))
else:
- out = subprocess.run(["pgrep", "-x", "cloudflared"], capture_output=True, text=True, timeout=5).stdout
- pids = [int(p) for p in out.split() if p.isdigit()]
+ text = subprocess.run(["ps", "-axo", "pid=,comm=,args="], capture_output=True, text=True, timeout=5).stdout
+ for line in text.splitlines():
+ m = re.match(r"\s*(\d+)\s+(\S+)\s*(.*)$", line)
+ if m and re.search(r"(^|/)cloudflared$", m.group(2)):
+ out.append((int(m.group(1)), m.group(3)))
except (OSError, subprocess.SubprocessError):
- return None
- if not [p for p in pids if p not in exclude]:
- return None
- try:
- if sys.platform.startswith("linux"):
- active = subprocess.run(["systemctl", "is-active", "cloudflared"], capture_output=True, text=True, timeout=5).stdout.strip()
- if active == "active":
- return "service"
- except (OSError, subprocess.SubprocessError):
- pass
- return "process"
+ return []
+ return [(pid, cmd) for pid, cmd in out if pid not in exclude]
+
+
+def own_tunnel_pids(procs: list[tuple[int, str]], port: int) -> list[int]:
+ """The processes that are clearly this server's own tunnel: their --url points at its port. The others serve other tunnels."""
+ pat = re.compile(rf"--url[= ]\S*:{int(port)}(?:/|\s|$)")
+ return [pid for pid, cmd in procs if pat.search(cmd)]
+
+
+def other_tunnel_note(pids: list[int]) -> str:
+ return (f"cloudflared is already running for another tunnel (PID {pids[0]})." if len(pids) == 1
+ else f"cloudflared is already running for other tunnels (PIDs {', '.join(map(str, pids))}).")
def find_tailscale() -> str | None:
@@ -329,10 +340,12 @@ def start_tunnel(name: str, port: int, *, wait: float = 45.0) -> tuple[str | Non
existing = tunnel_info(name)
if existing and existing.get("url") and existing.get("port") == port:
return existing["url"], "The tunnel was already running."
- other = cloudflared_running(exclude=(int(existing["pid"]),) if existing else ())
- if other:
- return None, ("Cloudflare’s connector is already running on this computer" + (" as a system service" if other == "service" else "") +
- ", so Strata did not start a second one. Stop it first (or use its tunnel as it is), then connect again here.")
+ running = cloudflared_procs(exclude=(int(existing["pid"]),) if existing else ())
+ own = own_tunnel_pids(running, port)
+ if own:
+ return None, (f"Strata’s tunnel for this address is already running (PID {', '.join(map(str, own))}), so Strata did not start a "
+ "second one. Stop it first (or use it as it is), then connect again here.")
+ note = other_tunnel_note([pid for pid, _ in running]) if running else ""
stop_tunnel(name)
log = _state_dir() / f"{Path(name).name}.tunnel.log"
argv = [exe, "tunnel", "--no-autoupdate", "--url", f"http://127.0.0.1:{port}"]
@@ -363,7 +376,7 @@ def start_tunnel(name: str, port: int, *, wait: float = 45.0) -> tuple[str | Non
stop_tunnel(name)
return None, ("The Cloudflare tunnel did not come up in time. Check your internet connection and try again; "
"the server itself is running and still works on this computer.")
- return url, "The Cloudflare tunnel is up. Anyone with the address can reach the server, so keep the API key on."
+ return url, "The Cloudflare tunnel is up. Anyone with the address can reach the server, so keep the API key on." + (" " + note if note else "")
def tunnel_info(name: str) -> dict | None:
diff --git a/tests/terminal/test_cloudflared_find.py b/tests/terminal/test_cloudflared_find.py
index 6e9d7c3cb..62645467d 100644
--- a/tests/terminal/test_cloudflared_find.py
+++ b/tests/terminal/test_cloudflared_find.py
@@ -96,30 +96,50 @@ class Places(unittest.TestCase):
self.assertTrue(access._cf_new_enough(""))
-class NoSecondConnector(unittest.TestCase):
- def test_a_running_connector_is_reported_and_not_doubled(self):
- with mock.patch.object(access, "find_cloudflared", return_value="/usr/bin/cloudflared"), \
- mock.patch.object(access, "tunnel_info", return_value=None), \
- mock.patch.object(access, "cloudflared_running", return_value="service"), \
+class OtherTunnels(unittest.TestCase):
+ PS = (" 4242 cloudflared /usr/bin/cloudflared --no-autoupdate tunnel run --token SECRETSECRETSECRETSECRET\n"
+ " 77 cloudflared cloudflared tunnel --no-autoupdate --url http://127.0.0.1:8080\n"
+ " 90 bash bash -c cloudflared\n 100 sshd sshd\n")
+
+ def test_every_cloudflared_is_listed_with_its_pid_and_our_own_pid_is_left_out(self):
+ with mock.patch.object(access, "WINDOWS", False), mock.patch.object(access.subprocess, "run", return_value=mock.Mock(stdout=self.PS)):
+ self.assertEqual([p for p, _ in access.cloudflared_procs()], [4242, 77])
+ self.assertEqual([p for p, _ in access.cloudflared_procs(exclude=(4242,))], [77])
+
+ def test_only_a_tunnel_pointing_at_this_servers_port_is_its_own(self):
+ procs = [(4242, "cloudflared tunnel run --token X"), (77, "cloudflared tunnel --url http://127.0.0.1:8080"), (5, "cloudflared tunnel --url http://127.0.0.1:18080")]
+ self.assertEqual(access.own_tunnel_pids(procs, 8080), [77])
+ self.assertEqual(access.own_tunnel_pids(procs, 9999), [])
+ self.assertEqual(access.other_tunnel_note([4242]), "cloudflared is already running for another tunnel (PID 4242).")
+ self.assertEqual(access.other_tunnel_note([1, 2]), "cloudflared is already running for other tunnels (PIDs 1, 2).")
+
+ def test_the_servers_own_tunnel_already_running_is_not_doubled(self):
+ with mock.patch.object(access, "find_cloudflared", return_value="/usr/bin/cloudflared"), mock.patch.object(access, "tunnel_info", return_value=None), \
+ mock.patch.object(access, "cloudflared_procs", return_value=[(31, "cloudflared tunnel --url http://127.0.0.1:8080")]), \
mock.patch.object(access.subprocess, "Popen") as popen:
url, message = access.start_tunnel("demo", 8080)
self.assertIsNone(url)
popen.assert_not_called()
- self.assertIn("already running on this computer as a system service", message)
+ self.assertIn("already running (PID 31)", message)
self.assertIn("did not start a second one", message)
- def test_running_detection_ignores_strata_own_pid_and_names_a_service(self):
- def fake_run(argv, **kw):
- out = {"pgrep": "4242\n", "systemctl": "active\n"}[argv[0]]
- return mock.Mock(stdout=out, returncode=0)
- with mock.patch.object(access, "WINDOWS", False), mock.patch.object(access.sys, "platform", "linux"), \
- mock.patch.object(access.subprocess, "run", side_effect=fake_run):
- self.assertEqual(access.cloudflared_running(), "service")
- self.assertIsNone(access.cloudflared_running(exclude=(4242,)))
-
- def test_a_missing_pgrep_is_never_a_block(self):
+ def test_another_tunnel_running_does_not_stop_a_quick_tunnel(self):
+ proc = mock.Mock(pid=55)
+ proc.poll.return_value = None
+ with tempfile.TemporaryDirectory() as tmp, mock.patch.object(access, "find_cloudflared", return_value="/usr/bin/cloudflared"), \
+ mock.patch.object(access, "tunnel_info", return_value=None), mock.patch.object(access, "stop_tunnel"), \
+ mock.patch.object(access, "_state_dir", return_value=Path(tmp)), \
+ mock.patch.object(access, "cloudflared_procs", return_value=[(4242, "cloudflared tunnel run --token X")]), \
+ mock.patch.object(access.subprocess, "Popen", side_effect=lambda *a, **k: (k["stdout"].write(b"https://abc-def.trycloudflare.com"), k["stdout"].flush(), proc)[2]) as popen, \
+ mock.patch("strata_control.procs.start_token", return_value="t"), mock.patch("strata_control.procs.command_line", return_value=["x"]):
+ url, message = access.start_tunnel("demo", 8080, wait=2)
+ popen.assert_called_once()
+ self.assertEqual(url, "https://abc-def.trycloudflare.com")
+ self.assertIn("cloudflared is already running for another tunnel (PID 4242).", message)
+
+ def test_a_missing_ps_is_never_a_block(self):
with mock.patch.object(access, "WINDOWS", False), mock.patch.object(access.subprocess, "run", side_effect=FileNotFoundError):
- self.assertIsNone(access.cloudflared_running())
+ self.assertEqual(access.cloudflared_procs(), [])
if __name__ == "__main__":