Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#866 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
csharp, node.js
Área
devtools

Línea de trabajo

Comienza con StartCliServerAsync y el punto de entrada existente ResolveCliCommand descrito en el issue; después, reproduce el fallo en Windows con una Copilot CLI instalada globalmente mediante npm. Compara el comportamiento de lanzamiento del proceso de .NET con la corrección del Python SDK y verifica que el SDK pueda iniciar la instalación de copilot.cmd sin dejar de conservar el manejo existente de .js.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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)
Lenguaje dominante
Java
Estrellas
10.5k
Forks
1.5k
Merge medio
1 d 9 h
PR fusionados (30 d)
131

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/copilot-sdk

Todos los issues de github/copilot-sdk

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.