fix(cli): detect symlinked entrypoints (#652)

This commit is contained in:
shekohex
2026-03-13 09:49:25 +02:00
committed by GitHub
parent 8eecf1c0e9
commit 9fb7c90dbd
3 changed files with 87 additions and 11 deletions
+2 -11
View File
@@ -7,6 +7,7 @@ import path from 'path';
import crypto from 'crypto';
import { spawn, spawnSync } from 'child_process';
import { fileURLToPath, pathToFileURL } from 'url';
import { isModuleCliExecution } from './cli-entry.js';
import { cloudflareTunnelProviderCapabilities } from '../server/lib/tunnels/providers/cloudflare.js';
import {
intro as clackIntro, outro as clackOutro, log as clackLog,
@@ -4614,17 +4615,7 @@ async function main() {
await commands[command](options);
}
const isCliExecution = (() => {
const entry = process.argv[1];
if (typeof entry !== 'string' || entry.length === 0) {
return false;
}
try {
return pathToFileURL(path.resolve(entry)).href === import.meta.url;
} catch {
return false;
}
})();
const isCliExecution = isModuleCliExecution();
if (isCliExecution) {
let isHandlingSigint = false;