Merge pull request #41 from Askhz/fix/rg-install
fix: ripgrep 安装支持内网私服兜底 & 修复终端进程名为 csc
This commit is contained in:
commit
9191df6949
|
|
@ -31,6 +31,8 @@ const RG_VERSION = "15.0.1"
|
||||||
const DEFAULT_RELEASE_BASE = `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
const DEFAULT_RELEASE_BASE = `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
||||||
const MIRROR_RELEASE_BASE = `https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
const MIRROR_RELEASE_BASE = `https://ghproxy.net/https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
|
||||||
const RELEASE_BASE = (process.env.RIPGREP_DOWNLOAD_BASE ?? DEFAULT_RELEASE_BASE).replace(/\/$/, "")
|
const RELEASE_BASE = (process.env.RIPGREP_DOWNLOAD_BASE ?? DEFAULT_RELEASE_BASE).replace(/\/$/, "")
|
||||||
|
// costrict change: fallback to private registry when GitHub and ghproxy are both unreachable
|
||||||
|
const COSTRICT_PRIVATE_BASE = "https://shenma.sangfor.com.cn/costrict-cli/pkg/ripgrep"
|
||||||
|
|
||||||
const scriptDir = path.dirname(__filename)
|
const scriptDir = path.dirname(__filename)
|
||||||
const projectRoot = path.resolve(scriptDir, "..")
|
const projectRoot = path.resolve(scriptDir, "..")
|
||||||
|
|
@ -298,6 +300,18 @@ async function downloadAndExtract() {
|
||||||
lastError = e
|
lastError = e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// costrict change: fallback to private registry (intranet) when all public mirrors fail
|
||||||
|
if (!buffer) {
|
||||||
|
const privateUrl = `${COSTRICT_PRIVATE_BASE}/ripgrep-v${RG_VERSION}-${target}.${ext}`
|
||||||
|
try {
|
||||||
|
console.log(`[ripgrep] Trying private registry: ${privateUrl}`)
|
||||||
|
buffer = await downloadUrlToBufferWithFallback(privateUrl)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(`[ripgrep] Private registry download failed: ${e instanceof Error ? e.message : e}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
throw lastError
|
throw lastError
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1362,7 +1362,7 @@ async function run(): Promise<CommanderCommand> {
|
||||||
// terminal shell integration may mirror the process name to the tab.
|
// terminal shell integration may mirror the process name to the tab.
|
||||||
// After init() so settings.json env can also gate this (gh-4765).
|
// After init() so settings.json env can also gate this (gh-4765).
|
||||||
if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)) {
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)) {
|
||||||
process.title = "claude";
|
process.title = "csc";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach logging sinks so subcommand handlers can use logEvent/logError.
|
// Attach logging sinks so subcommand handlers can use logEvent/logError.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user