From 963f6d2a5ea15a5bd56ec015d0e528a431472287 Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Mon, 9 Nov 2026 22:58:58 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=BC=E6=8E=A5=20PATH=20=E6=97=B6?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=B9=B3=E5=8F=B0=E5=88=86=E9=9A=94=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- io.github.lithe-idea.cargo-build/backend/provider.mjs | 4 ++-- test/provider.test.mjs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/io.github.lithe-idea.cargo-build/backend/provider.mjs b/io.github.lithe-idea.cargo-build/backend/provider.mjs index e9c2e41..e2e2a58 100644 --- a/io.github.lithe-idea.cargo-build/backend/provider.mjs +++ b/io.github.lithe-idea.cargo-build/backend/provider.mjs @@ -1,5 +1,5 @@ import { realpath } from 'node:fs/promises'; -import { dirname, isAbsolute, relative, resolve, sep } from 'node:path'; +import { delimiter, dirname, isAbsolute, relative, resolve, sep } from 'node:path'; import { fileURLToPath } from 'node:url'; const compare = (a, b) => a < b ? -1 : a > b ? 1 : 0; @@ -71,7 +71,7 @@ export function registerCargoProvider(backend, PluginError) { const args = ['metadata', '--format-version', '1', '--no-deps', '--manifest-path', resolve(directory, 'Cargo.toml')]; if (options.offline === true) args.push('--offline'); const processEnvironment = { ...process.env, ...environment }; - if (tool) processEnvironment.PATH = `${dirname(executable)}:${processEnvironment.PATH ?? ''}`; + if (tool) processEnvironment.PATH = `${dirname(executable)}${delimiter}${processEnvironment.PATH ?? ''}`; let result; try { result = await context.run(executable, args, { cwd: directory, env: processEnvironment, maxOutputBytes: 8 * 1024 * 1024 }); diff --git a/test/provider.test.mjs b/test/provider.test.mjs index ff805f5..8316b3e 100644 --- a/test/provider.test.mjs +++ b/test/provider.test.mjs @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { mkdtemp, mkdir, realpath, rm, symlink, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; -import { join } from 'node:path'; +import { delimiter, join } from 'node:path'; import { pathToFileURL } from 'node:url'; import test from 'node:test'; import { createBackend, PluginError as SDKPluginError } from '../vendor/lithe-plugin-sdk/src/index.mjs'; @@ -57,7 +57,7 @@ test('initialization is passive; metadata uses the host tool and only supported assert.equal(calls[0][0], '/fake-tools/cargo'); assert.deepEqual(calls[0][1], ['metadata', '--format-version', '1', '--no-deps', '--manifest-path', join(root, 'Cargo.toml'), '--offline']); assert.equal(calls[0][2].cwd, root); - assert.ok(calls[0][2].env.PATH.startsWith('/fake-tools:')); + assert.ok(calls[0][2].env.PATH.startsWith(`/fake-tools${delimiter}`)); }); test('relative and symlink build-root escapes are refused before Cargo starts', { timeout: 5000 }, async (t) => {