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) => {