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

Đang mở Phù hợp với người mới
#737 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu bằng cách tìm CliCommand::error() và CliCommand::execute(), sau đó theo dõi cách các giá trị trả về của lệnh trở thành trạng thái thoát của tiến trình. Kiểm tra các trường hợp config:publish được liệt kê trong issue và thêm hoặc chạy các bài kiểm thử tập trung vào những lỗi đã báo cáo và các lệnh thành công. Công việc hoàn tất khi error() dẫn đến trạng thái 1, quá trình hoàn tất bình thường dẫn đến trạng thái 0 và thay đổi hành vi được ghi lại trong changelog.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
PHP
Star
44
Fork
22
Merge trung bình
2 giờ 49 phút
Pull request đã merge (30 ngày)
61

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quantum-php/framework

Tất cả issue của quantum-php/framework

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.