php qt commands exit with status 0 when they report an error

Abierto Apto para principiantes
#737 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
cli

Línea de trabajo

Empieza por localizar CliCommand::error() y CliCommand::execute(), y luego sigue cómo los valores de retorno de los comandos se convierten en estados de salida del proceso. Comprueba los casos de config:publish indicados en el issue y añade o ejecuta pruebas específicas para los errores reportados y los comandos que terminan correctamente. El objetivo se cumple cuando error() da lugar al estado 1, la finalización normal da lugar al estado 0 y el cambio de comportamiento queda registrado en el changelog.

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

Descripción

Summary

A php qt command that stops on an error prints the message with CliCommand::error() and returns, but the process still exits with status 0. CliCommand::execute() calls exec() and always returns Command::SUCCESS. Scripts, deploy steps and CI jobs cannot tell such a failure from a success.

Where it happens

Eight core commands report errors this way: config:publish, cron:run, debugbar, core:env, module:generate, openapi, cache:clear and route:list. Application commands that extend CliCommand behave the same. A command that throws an exception already exits with a non-zero status; only errors reported through error() are affected.

For example, php qt config:publish Cache exits with 0 when shared/config/cache.php already exists and -y is not given, although nothing was published.

Scope

  1. CliCommand::error() marks the command as failed.
  2. CliCommand::execute() returns Command::FAILURE when the command was marked as failed, and Command::SUCCESS otherwise.
  3. exec() keeps its signature, so existing commands, core and application, need no change.

Acceptance criteria

  • a command that calls error() exits with status 1
  • a command that finishes without error() exits with status 0
  • config:publish exits with 1 for an existing file without -y, an unknown package or module, and a failed copy
  • the change is listed in the changelog as a behavior change, since scripts that ignored the status may now see failures
Lenguaje dominante
PHP
Estrellas
44
Forks
22
Merge medio
2 h 49 min
PR fusionados (30 d)
61

Preparar el entorno

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 quantum-php/framework

Todos los issues de quantum-php/framework

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.