We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
invoke black
The invoke prints the code of the unicode chars returned by the black in its output:
black
All done! \u2728 \U0001f370 \u2728 ...
However, this is the expected output (the output of running directly black src):
black src
All done! ✨ 🍰 ✨ ...
Executing black with subprocess.run produces the expected result:
subprocess.run
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) >>>
The text was updated successfully, but these errors were encountered:
Changing the black task code to look like bellow produces the expected results:
from io import StringIO from invoke.tasks import task from invoke.context import Context @task def black(c: Context) -> None: """Formats code with `black`.""" s = StringIO() c.run("black src", err_stream=s) print(s.getvalue().encode().decode("unicode-escape"))
Invoking the task:
inv black
The output:
Is this a bug or am I missing something?
Sorry, something went wrong.
No branches or pull requests
Create this simple task:
Run the task with
invoke
:The
invoke
prints the code of the unicode chars returned by theblack
in its output:However, this is the expected output (the output of running directly
black src
):Executing
black
withsubprocess.run
produces the expected result:The text was updated successfully, but these errors were encountered: