mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
* fix: refresh host environments before structured agent command resolution * fix: ship the owning server CLI for managed remote agents * test: include the shipped CLI in remote install fixtures * Bind packaged agent CLI calls to their execution host * Keep owning-server CLI binding scoped to managed agents * Serve the last shell environment to chat starts and refresh it in the background Only the first chat start waits for the login shell; later starts get the last snapshot and refresh it in the background once it is 10 s old. On Windows hosts without the registry addon (managed server slots), the saved PATH is reread with reg.exe. The Windows server CLI launcher stager now checks the target architecture, and the CLI help says ambient selectors are ignored inside a managed server. * Keep the last good shell environment when a refresh fails, and load the Windows profile once A login-shell capture now says whether the shell produced the env or Orca fell back to its own, and only a real capture replaces the snapshot. Windows loads the PowerShell profile once per process and refreshes only the saved PATH. The reg.exe fallback queries the whole key so a missing user Path no longer drops the saved PATH. The first capture starts when the resolvers are created. * Keep the last good login-shell env for other readers while a forced refresh runs * Mark the Claude launch resolver as a reviewed router-aware module It only types the chat command resolver it injects; main's launch-routing guard (#26801) matched the name. * Keep a settled login-shell env for readers during a refresh and share the first run - Any settled cached entry, a fallback included, now serves other readers while a forced capture runs; only a real capture replaces it. - Native chat's first capture shares a run a startup reader already began, so the login shell runs once per process at startup on macOS/Linux. - Type the injected Claude resolver without naming resolveClaudeCommand. - Cover the runtime's Claude command options, the owning-host --host check, and the PTY flag drop. * Drop an inherited owning-host flag from daemon terminal panes The persistent terminal daemon merges its own environment into every pane, so an inherited ORCA_CLI_OWNING_HOST reached desktop panes even though main strips it from the spawn env. Drop it with the other per-launch CLI variables. * Route agents to their own server through ordinary launch defaults; start the first chat after an install The native-chat agent environment now sets the owning server's ORCA_USER_DATA_PATH and empty ORCA_ENVIRONMENT / ORCA_PAIRING_CODE / ORCA_REMOTE_PAIRING, which the CLI already reads as unset; empty rather than deleted, because the spawn merges the launch overlay over the server's own env. The ORCA_CLI_OWNING_HOST flag, the CLI's skip of ambient selectors, the launchers' export of it, the terminal clean-up, the help-text exception and the WSL launcher guard are gone, so a person's terminal follows their own settings as on main. A launch that finds no program in the shell snapshot waits for one shared refresh (at most one shell timeout) and resolves again; create support rereads the shell once before refusing. On Windows a failed PowerShell profile load is retried on the next refresh instead of being kept until restart. * One shared shell reread when an agent's program is missing The pre-create check for OpenCode, OMP and Pi forced its own login-shell capture on every refusal: not shared with launches, one per concurrent check, triggered by an installed-but-too-old version too, and an older capture finishing last could overwrite a newer cached environment. On Windows, every launch miss also reran a failed PowerShell profile load, bypassing the 10-second limit. - One saved shell environment per host: chat launches, their misses, the pre-create check and AI commit messages read it and share one refresh. - The pre-create check resolves the agent's program the way a launch does, so only a missing program waits for the refresh; registrations declare how to resolve their launch and check its version. - A forced login-shell capture joins one already running for the same shell, so captures cannot land out of order. - On Windows, a miss within 10 s of a failed PowerShell load rereads only the saved PATH. * One owner for the cached shell environment Review found two more races in the reread-on-miss machinery, both from the host wrapper keeping its own snapshot beside the login-shell cache: - A launch that found no program could join a reread that started before the agent was installed, and spend its one retry on the old PATH. - On Windows, saved-PATH rereads renewed the snapshot's age, so a failed PowerShell profile was never retried while launches kept missing. The login-shell cache is now the only owner of the captured environment, the run in progress and which result wins (the newest run started; a fallback never replaces a captured env). It takes three options instead of `force`: - startedAfter: a lookup that found nothing waits for a run that started no earlier than the lookup did, joining one if it has, else starting one. - refreshAfterMs: serve the last result and rerun in the background once the last attempt is older. - keepCaptured: a captured env is kept for good; only a fallback is rerun (Windows' PowerShell profile). The host wrapper keeps only policy: the 10 s interval, on Windows the saved PATH laid over the profile env on every read (a miss forces a fresh registry read), and the settings overlays. Its snapshot, pending promise, staleness and Windows "loaded" bookkeeping are gone. A lookup's start time travels with the miss (resolveAgainAfterRefreshOnMissingProgram passes it). * Read an injected shell environment once per runtime, as main does The previous commit read an injected environment on every acquisition, which broke main's 'caches shell exports but re-reads configured overrides for a resume' contract. It is read once when the resolvers are made again. * Model lists reread the environment on a missing program, as launches do Live QA: the first new chat after installing Claude showed "Claude wasn't found on the computer running this chat". The chat launch itself reread the login shell and started the new binary, but Claude's model-list check ran first, with the environment read before the install, and never retried: catalog probes were deliberately built without the miss refresh. The retry now lives in each agent's one shared lookup of its binary and environment, which a launch and a model listing both call: resolveCodexStructuredInvocation, resolveAcpLaunchInvocation, a new shared resolvePiRpcInvocation, and resolveClaudeChildEnvSources (which already had it). Each catalog probe is given the runtime's refreshAfterMissingProgram, and the catalog context no longer strips it, so a listing and a launch reread the same single-owner environment the same way. * Pass optional launch lookups through directly instead of conditional spreads * Read the host shell env through resolveLoginShellEnvironment; drop the extra wait cap CI on the merge with main failed main's new codex-workspace-relative-path test (#26684), which mocks the login-shell module with only resolveLoginShellEnvironment: the wrapper called captureLoginShellEnvironment and imported the spawn-timeout constant. The wrapper only needs the env, so it reads through resolveLoginShellEnvironment again, as on main. The miss wait no longer races its own 5 s timer: the shell run it waits for is already killed at the spawn timeout, so the second cap was a guard over the same bound. The constant goes back to private, as on main. * Test that a hung login shell holds a launch miss for at most one shell timeout The bound lives in the one owner: the shell run is killed at the spawn timeout (5 s) and settles to a fallback, which never replaces a captured snapshot. A mutation raising that timeout fails this test. * A program found through a relative PATH entry is not missing Main's #26684 runs Codex through a workspace-relative PATH entry (`bin`, `node_modules/.bin`). The lookup searches such an entry against Orca's own directory and returns the bare name; the spawn then finds the program in the chat's directory. Counting that bare name as missing made every such launch wait for a login-shell reread. The retry now fires only when the lookup truly found nothing: a bare name back from a PATH whose entries are all absolute. Each agent's one lookup tells it which PATH it searched. * Count a relative PATH entry as found only when it holds the program; Windows miss waits for a saved PATH read started after it looked A bare name with a relative PATH entry is checked from the launch's working directory, so an agent in neither entry still gets its one reread. On Windows the miss no longer joins a registry read that began before the lookup.
369 lines
14 KiB
JavaScript
369 lines
14 KiB
JavaScript
import {
|
|
copyFileSync,
|
|
existsSync,
|
|
mkdirSync,
|
|
mkdtempSync,
|
|
readFileSync,
|
|
rmSync,
|
|
utimesSync,
|
|
writeFileSync
|
|
} from 'node:fs'
|
|
import { tmpdir } from 'node:os'
|
|
import { dirname, join, resolve } from 'node:path'
|
|
import { spawnSync } from 'node:child_process'
|
|
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
shouldReuseCompiledWindowsRustExecutable,
|
|
windowsRustExecutableFileVersion,
|
|
windowsRustExecutableTarget,
|
|
windowsRustExecutableFingerprint
|
|
} from './windows-rust-executable-build.mjs'
|
|
import { findDynamicVcRuntimeImports, readPeImportedDllNames } from './windows-pe-imports.mjs'
|
|
|
|
const itCrossHost = process.platform === 'win32' ? it.skip : it
|
|
const projectRoot = resolve(import.meta.dirname, '../..')
|
|
const WINDOWS_LOCK_CODES = ['EBUSY', 'ENOTEMPTY', 'EPERM']
|
|
|
|
// Why: Windows releases the image handle on a just-executed exe (and finishes the
|
|
// AV scan of the freshly compiled one) after the process exits, so tearing down the
|
|
// fixture races those locks. Retry, then leave the temp tree rather than reporting a
|
|
// teardown lock as a launcher failure.
|
|
function removeFixtureTree(path) {
|
|
try {
|
|
rmSync(path, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 })
|
|
} catch (error) {
|
|
if (process.platform !== 'win32' || !WINDOWS_LOCK_CODES.includes(error?.code)) {
|
|
throw error
|
|
}
|
|
}
|
|
}
|
|
// Why: a cold cargo build compiles the resource crate and links from scratch,
|
|
// which far exceeds Vitest's 5s unit budget on a hosted Windows runner. Later
|
|
// cases reuse the shared target directory, so only the first pays it.
|
|
function itWindows(name, test) {
|
|
const runner = process.platform === 'win32' ? it : it.skip
|
|
runner(name, { timeout: 300_000 }, test)
|
|
}
|
|
|
|
describe('Windows CLI launcher', () => {
|
|
it('reuses restored builds only while all embedded inputs and the release version match', () => {
|
|
const root = mkdtempSync(join(tmpdir(), 'orca-cli-launcher-reuse-'))
|
|
try {
|
|
const inputs = ['main.rs', 'build.rs', 'Cargo.toml', 'app.manifest', 'icon.ico'].map(
|
|
(name) => {
|
|
const path = join(root, name)
|
|
writeFileSync(path, name)
|
|
return path
|
|
}
|
|
)
|
|
const outputPath = join(root, 'orca.exe')
|
|
const fingerprint = windowsRustExecutableFingerprint(inputs, '1.4.214')
|
|
expect(shouldReuseCompiledWindowsRustExecutable(outputPath, fingerprint)).toBe(false)
|
|
writeFileSync(outputPath, 'binary')
|
|
expect(shouldReuseCompiledWindowsRustExecutable(outputPath, fingerprint)).toBe(false)
|
|
writeFileSync(`${outputPath}.sha256`, fingerprint)
|
|
for (const input of inputs) {
|
|
utimesSync(input, new Date(), new Date())
|
|
}
|
|
expect(
|
|
shouldReuseCompiledWindowsRustExecutable(
|
|
outputPath,
|
|
windowsRustExecutableFingerprint(inputs, '1.4.214')
|
|
)
|
|
).toBe(true)
|
|
expect(
|
|
shouldReuseCompiledWindowsRustExecutable(
|
|
outputPath,
|
|
windowsRustExecutableFingerprint(inputs, '1.4.215')
|
|
)
|
|
).toBe(false)
|
|
for (const input of inputs) {
|
|
const original = readFileSync(input)
|
|
writeFileSync(input, 'changed')
|
|
expect(
|
|
shouldReuseCompiledWindowsRustExecutable(
|
|
outputPath,
|
|
windowsRustExecutableFingerprint(inputs, '1.4.214')
|
|
)
|
|
).toBe(false)
|
|
writeFileSync(input, original)
|
|
}
|
|
} finally {
|
|
removeFixtureTree(root)
|
|
}
|
|
})
|
|
|
|
it('reduces a prerelease to the numeric version Windows can record', () => {
|
|
expect(windowsRustExecutableFileVersion('1.4.214-daily.202609281300')).toBe('1.4.214.0')
|
|
expect(windowsRustExecutableFileVersion('1.4.214')).toBe('1.4.214.0')
|
|
for (const version of ['1.4.65535', '1.4', '1.4.214"', undefined]) {
|
|
expect(() => windowsRustExecutableFileVersion(version)).toThrow('Invalid Windows')
|
|
}
|
|
})
|
|
|
|
itWindows(
|
|
'embeds publisher, release version, icon and an unelevated application manifest',
|
|
() => {
|
|
const root = mkdtempSync(join(tmpdir(), 'orca launcher metadata '))
|
|
try {
|
|
const launcherPath = join(root, 'orca.exe')
|
|
const build = spawnSync(
|
|
process.execPath,
|
|
['config/scripts/build-windows-cli-launcher.mjs', '--output', launcherPath],
|
|
{ cwd: projectRoot, encoding: 'utf8' }
|
|
)
|
|
expect(build.status, `${build.stdout}\n${build.stderr}`).toBe(0)
|
|
const inspect = spawnSync(
|
|
'powershell.exe',
|
|
[
|
|
'-NoProfile',
|
|
'-NonInteractive',
|
|
'-Command',
|
|
'[Diagnostics.FileVersionInfo]::GetVersionInfo($env:ORCA_TEST_LAUNCHER) | ConvertTo-Json -Compress'
|
|
],
|
|
{ encoding: 'utf8', env: { ...process.env, ORCA_TEST_LAUNCHER: launcherPath } }
|
|
)
|
|
expect(inspect.status, inspect.stderr).toBe(0)
|
|
const info = JSON.parse(inspect.stdout)
|
|
const { version } = JSON.parse(readFileSync(join(projectRoot, 'package.json'), 'utf8'))
|
|
expect(info.CompanyName).toBe('Stably AI')
|
|
expect(info.ProductName).toBe('Orca')
|
|
expect(info.FileDescription).toBe('Orca CLI Launcher')
|
|
expect(info.FileVersion).toBe(`${version.split(/[+-]/)[0]}.0`)
|
|
expect(info.ProductVersion).toBe(version)
|
|
const binary = readFileSync(launcherPath)
|
|
expect(binary.includes(Buffer.from('requestedExecutionLevel level="asInvoker"'))).toBe(true)
|
|
const imports = readPeImportedDllNames(binary)
|
|
expect(imports.map((name) => name.toLowerCase())).toContain('kernel32.dll')
|
|
expect(findDynamicVcRuntimeImports(imports)).toEqual([])
|
|
const icon = readFileSync(join(projectRoot, 'resources', 'build', 'icon.ico'))
|
|
const imageSize = icon.readUInt32LE(14)
|
|
const imageOffset = icon.readUInt32LE(18)
|
|
expect(binary.includes(icon.subarray(imageOffset, imageOffset + imageSize))).toBe(true)
|
|
} finally {
|
|
removeFixtureTree(root)
|
|
}
|
|
}
|
|
)
|
|
|
|
itCrossHost('fails closed when the Windows launcher cannot be compiled on this host', () => {
|
|
const outputRoot = mkdtempSync(join(tmpdir(), 'orca cross-host launcher '))
|
|
try {
|
|
const result = spawnSync(
|
|
process.execPath,
|
|
['config/scripts/build-windows-cli-launcher.mjs', '--output', join(outputRoot, 'orca.exe')],
|
|
{ cwd: projectRoot, encoding: 'utf8' }
|
|
)
|
|
|
|
expect(result.status).not.toBe(0)
|
|
expect(result.stderr).toContain('Windows CLI launcher')
|
|
expect(result.stderr).toContain('Windows host')
|
|
} finally {
|
|
removeFixtureTree(outputRoot)
|
|
}
|
|
})
|
|
|
|
itWindows('preserves a multiline argument from PowerShell through the native launcher', () => {
|
|
const appRoot = mkdtempSync(join(tmpdir(), 'orca cli launcher '))
|
|
try {
|
|
const resourcesPath = join(appRoot, 'resources')
|
|
const launcherPath = join(resourcesPath, 'bin', 'orca.exe')
|
|
const cliPath = join(resourcesPath, 'app.asar.unpacked', 'out', 'cli', 'index.js')
|
|
mkdirSync(join(resourcesPath, 'bin'), { recursive: true })
|
|
mkdirSync(dirname(cliPath), { recursive: true })
|
|
copyFileSync(process.execPath, join(appRoot, 'Orca.exe'))
|
|
writeFileSync(
|
|
cliPath,
|
|
`process.stdout.write(JSON.stringify({
|
|
argv: process.argv.slice(2),
|
|
electronRunAsNode: process.env.ELECTRON_RUN_AS_NODE,
|
|
nodeOptions: process.env.NODE_OPTIONS ?? null,
|
|
orcaNodeOptions: process.env.ORCA_NODE_OPTIONS ?? null
|
|
}))\n`,
|
|
'utf8'
|
|
)
|
|
|
|
const build = spawnSync(
|
|
process.execPath,
|
|
['config/scripts/build-windows-cli-launcher.mjs', '--output', launcherPath],
|
|
{ cwd: projectRoot, encoding: 'utf8' }
|
|
)
|
|
expect(build.status, `${build.stdout}\n${build.stderr}`).toBe(0)
|
|
|
|
const body = 'paragraph one line one\nparagraph one line two\n\nparagraph two'
|
|
const powershell = spawnSync(
|
|
'powershell.exe',
|
|
[
|
|
'-NoProfile',
|
|
'-NonInteractive',
|
|
'-Command',
|
|
'& $env:ORCA_TEST_LAUNCHER orchestration send --body $env:ORCA_TEST_BODY --json'
|
|
],
|
|
{
|
|
encoding: 'utf8',
|
|
env: {
|
|
...process.env,
|
|
NODE_OPTIONS: '--no-warnings',
|
|
ORCA_TEST_BODY: body,
|
|
ORCA_TEST_LAUNCHER: launcherPath
|
|
}
|
|
}
|
|
)
|
|
|
|
expect(powershell.status, powershell.stderr).toBe(0)
|
|
expect(JSON.parse(powershell.stdout)).toEqual({
|
|
argv: ['orchestration', 'send', '--body', body, '--json'],
|
|
electronRunAsNode: '1',
|
|
nodeOptions: null,
|
|
orcaNodeOptions: '--no-warnings'
|
|
})
|
|
} finally {
|
|
removeFixtureTree(appRoot)
|
|
}
|
|
})
|
|
|
|
it('cross-compiles only the architectures the orcad template ships', () => {
|
|
expect(windowsRustExecutableTarget(undefined)).toBeNull()
|
|
expect(windowsRustExecutableTarget('x64')).toBe('x86_64-pc-windows-msvc')
|
|
expect(windowsRustExecutableTarget('arm64')).toBe('aarch64-pc-windows-msvc')
|
|
expect(() => windowsRustExecutableTarget('ia32')).toThrow('Unsupported')
|
|
})
|
|
|
|
itWindows('runs a server profile CLI on pinned Node with argv and profile intact', () => {
|
|
const root = mkdtempSync(join(tmpdir(), 'orca server launcher '))
|
|
try {
|
|
const profile = join(root, 'server profile')
|
|
const launcherPath = join(profile, 'cli', 'bin', 'orca.exe')
|
|
const cliPath = join(root, 'server slot', 'out', 'cli', 'index.js')
|
|
mkdirSync(dirname(cliPath), { recursive: true })
|
|
writeFileSync(
|
|
cliPath,
|
|
`process.stdout.write(JSON.stringify({
|
|
argv: process.argv.slice(2),
|
|
profile: process.env.ORCA_USER_DATA_PATH,
|
|
electronRunAsNode: process.env.ELECTRON_RUN_AS_NODE ?? null,
|
|
nodeOptions: process.env.NODE_OPTIONS ?? null,
|
|
desktopMarker: process.env.ORCA_WINDOWS_PACKAGED_CLI_LAUNCHER ?? null
|
|
}))\n`,
|
|
'utf8'
|
|
)
|
|
const build = spawnSync(
|
|
process.execPath,
|
|
['config/scripts/build-windows-cli-launcher.mjs', '--output', launcherPath],
|
|
{ cwd: projectRoot, encoding: 'utf8' }
|
|
)
|
|
expect(build.status, `${build.stdout}\n${build.stderr}`).toBe(0)
|
|
writeFileSync(
|
|
join(dirname(launcherPath), 'orca-launcher.cfg'),
|
|
`node=${process.execPath}\ncli=${cliPath}\nuser-data=${profile}\n`
|
|
)
|
|
|
|
const inherited = {
|
|
...process.env,
|
|
ELECTRON_RUN_AS_NODE: '1',
|
|
NODE_OPTIONS: '--require C:\\missing\\preload.js',
|
|
ORCA_USER_DATA_PATH: 'C:\\another\\owner',
|
|
ORCA_WINDOWS_PACKAGED_CLI_LAUNCHER: '1',
|
|
ORCA_TEST_LAUNCHER: launcherPath
|
|
}
|
|
const expected = (body) => ({
|
|
argv: ['orchestration', 'send', '--body', body, '--json'],
|
|
profile,
|
|
electronRunAsNode: null,
|
|
nodeOptions: null,
|
|
desktopMarker: null
|
|
})
|
|
// Windows PowerShell 5.1 itself drops embedded double quotes, so its body has none.
|
|
const shellBody = 'line one & %PATH% ^caret\n\nline three'
|
|
const powershell = spawnSync(
|
|
'powershell.exe',
|
|
[
|
|
'-NoProfile',
|
|
'-NonInteractive',
|
|
'-Command',
|
|
'& $env:ORCA_TEST_LAUNCHER orchestration send --body $env:ORCA_TEST_BODY --json'
|
|
],
|
|
{ encoding: 'utf8', env: { ...inherited, ORCA_TEST_BODY: shellBody } }
|
|
)
|
|
expect(powershell.status, powershell.stderr).toBe(0)
|
|
expect(JSON.parse(powershell.stdout)).toEqual(expected(shellBody))
|
|
|
|
const body = 'line one "quoted" \\"escaped\\" & %PATH% ^caret\\\n\nline three\\'
|
|
const direct = spawnSync(launcherPath, expected(body).argv, {
|
|
encoding: 'utf8',
|
|
env: inherited
|
|
})
|
|
expect(direct.status, direct.stderr).toBe(0)
|
|
expect(JSON.parse(direct.stdout)).toEqual(expected(body))
|
|
} finally {
|
|
removeFixtureTree(root)
|
|
}
|
|
})
|
|
|
|
itWindows('survives an inherited environment block containing PATH and Path', () => {
|
|
const appRoot = mkdtempSync(join(tmpdir(), 'orca duplicate path launcher '))
|
|
try {
|
|
const resourcesPath = join(appRoot, 'resources')
|
|
const launcherPath = join(resourcesPath, 'bin', 'orca.exe')
|
|
const cliPath = join(resourcesPath, 'app.asar.unpacked', 'out', 'cli', 'index.js')
|
|
const outputPath = join(appRoot, 'child-result.json')
|
|
const harnessSourcePath = join(
|
|
projectRoot,
|
|
'config',
|
|
'scripts',
|
|
'fixtures',
|
|
'DuplicatePathProcessLauncher.cs'
|
|
)
|
|
const harnessPath = join(appRoot, 'DuplicatePathLauncher.exe')
|
|
mkdirSync(dirname(launcherPath), { recursive: true })
|
|
mkdirSync(dirname(cliPath), { recursive: true })
|
|
copyFileSync(process.execPath, join(appRoot, 'Orca.exe'))
|
|
writeFileSync(
|
|
cliPath,
|
|
`require('node:fs').writeFileSync(process.env.ORCA_TEST_OUTPUT, JSON.stringify({
|
|
electronRunAsNode: process.env.ELECTRON_RUN_AS_NODE,
|
|
pathKeys: Object.keys(process.env).filter((key) => key.toLowerCase() === 'path')
|
|
}))\n`,
|
|
'utf8'
|
|
)
|
|
const build = spawnSync(
|
|
process.execPath,
|
|
['config/scripts/build-windows-cli-launcher.mjs', '--output', launcherPath],
|
|
{ cwd: projectRoot, encoding: 'utf8' }
|
|
)
|
|
expect(build.status, `${build.stdout}\n${build.stderr}`).toBe(0)
|
|
|
|
const compiler = findFrameworkCompiler()
|
|
expect(compiler).not.toBeNull()
|
|
const compileHarness = spawnSync(
|
|
compiler,
|
|
['/nologo', '/target:exe', `/out:${harnessPath}`, harnessSourcePath],
|
|
{ encoding: 'utf8' }
|
|
)
|
|
expect(compileHarness.status, `${compileHarness.stdout}\n${compileHarness.stderr}`).toBe(0)
|
|
|
|
const launch = spawnSync(harnessPath, [launcherPath, outputPath], { encoding: 'utf8' })
|
|
expect(launch.status, `${launch.stdout}\n${launch.stderr}`).toBe(0)
|
|
expect(JSON.parse(readFileSync(outputPath, 'utf8'))).toEqual({
|
|
electronRunAsNode: '1',
|
|
pathKeys: ['PATH', 'Path']
|
|
})
|
|
} finally {
|
|
removeFixtureTree(appRoot)
|
|
}
|
|
})
|
|
})
|
|
|
|
function findFrameworkCompiler() {
|
|
const windowsDirectory = process.env.WINDIR ?? process.env.SystemRoot
|
|
if (!windowsDirectory) {
|
|
return null
|
|
}
|
|
return (
|
|
[
|
|
join(windowsDirectory, 'Microsoft.NET', 'Framework64', 'v4.0.30319', 'csc.exe'),
|
|
join(windowsDirectory, 'Microsoft.NET', 'Framework', 'v4.0.30319', 'csc.exe')
|
|
].find((candidate) => existsSync(candidate)) ?? null
|
|
)
|
|
}
|