context.run prints the codes of unicode chars from the output instead of printing the unicode characters themselves

Đang mở
#1,014 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Reproduce the issue with the provided task and invoke black, then inspect the output handling used by Context.run. Compare its behavior with direct black src and subprocess.run; done means Unicode characters such as ✨ and 🍰 are printed directly rather than as escape codes.

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

Mô tả

Create this simple task:

from invoke.tasks import task
from invoke.context import Context


@task
def black(c: Context) -> None:
    """Formats code with `black`."""
    c.run("black src")

Run the task with invoke:

invoke black

The invoke prints the code of the unicode chars returned by the black in its output:

All done! \u2728 \U0001f370 \u2728
...

However, this is the expected output (the output of running directly black src):

All done! ✨ 🍰 ✨
...

Executing black with subprocess.run produces the expected result:

Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep  6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess   
>>> subprocess.run("black src")
All done! ✨ 🍰 ✨
...
CompletedProcess(args='black src', returncode=0)
>>>
Ngôn ngữ chính
Python
Star
4.8k
Fork
412
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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 pyinvoke/invoke

Tất cả issue của pyinvoke/invoke

Issue tương tự

Thêm issue về Python

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.