[.NET] CreateProcess fails when Copilot CLI is installed via npm (copilot.cmd)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
Inizia con StartCliServerAsync e con l’entry point esistente ResolveCliCommand descritto nell’issue, quindi riproduci il problema su Windows con una Copilot CLI installata globalmente tramite npm. Confronta il comportamento di avvio del processo .NET con la correzione del Python SDK e verifica che l’SDK possa avviare l’installazione copilot.cmd mantenendo la gestione esistente di .js.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
On Windows, when the Copilot CLI is installed via npm, the only executables on PATH are copilot (extensionless) and copilot.cmd. There is no copilot.exe.
The .NET SDK's StartCliServerAsync uses ProcessStartInfo with UseShellExecute = false, which calls CreateProcess under the hood. CreateProcess cannot resolve .cmd/.bat files — it only finds native executables (.exe, .com). This results in:
System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'copilot'
with working directory '...'. The system cannot find the file specified.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at GitHub.Copilot.SDK.CopilotClient.StartCliServerAsync(...)
Running copilot in a terminal works fine because PowerShell/cmd.exe use PATHEXT to resolve .cmd wrappers. But the SDK's CreateProcess does not.
Output of where.exe copilot on affected machines:
C:\ProgramData\global-npm\copilot
C:\ProgramData\global-npm\copilot.cmd
This was already fixed in the Python SDK
PR #338 fixed the same issue for the Python SDK by using shutil.which() to resolve the full CLI path before spawning the subprocess.
Suggested fix for .NET
The SDK already has ResolveCliCommand which handles .js files by prepending node:
private static (string FileName, IEnumerable<string> Args) ResolveCliCommand(string cliPath, IEnumerable<string> args)
{
if (cliPath.EndsWith(".js", StringComparison.OrdinalIgnoreCase))
{
return ("node", new[] { cliPath }.Concat(args));
}
return (cliPath, args);
}
A similar approach for .cmd files (prepending cmd.exe /c) would work. Alternatively, resolve the PATH using PATHEXT-aware logic before passing to ProcessStartInfo.
Environment
- SDK: GitHub.Copilot.SDK 0.1.32 (NuGet)
- OS: Windows 11
- CLI install method: npm (global)
- Lingua principale
- Java
- Stelle
- 10.5k
- Fork
- 1.5k
- Merge medio
- 1g 9h
- PR unite (30g)
- 131
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/copilot-sdk
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
github/copilot-sdk#2709 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
github/copilot-sdk#2673 ·
-
bug testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
github/copilot-sdk#2628 ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
github/copilot-sdk#2627 · 1 commento ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
github/copilot-sdk#2493 ·
Tutte le issue di github/copilot-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
FasterXML/jackson-databind#6229 ·