Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[.NET] CreateProcess fails when Copilot CLI is installed via npm (copilot.cmd)

Aperta
#866 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp, node.js
Ambito
devtools

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/copilot-sdk

Tutte le issue di github/copilot-sdk

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.