Skip to content

Running shell commands with piping operator "|" results in unknown operator error #94

Answered by nat-n
adam2392 asked this question in Q&A
Discussion options

You must be logged in to vote

Indeed, the default task type (cmd) is executed as a subprocess without a shell. If you want to use shell features like the pipe operator then you need to create a shell task which can be done like so:

[tool.poe.tasks]
clean_so.shell = """
find . -name "*.so" | xargs rm -f
find . -name "*.pyd" | xargs rm -f
"""

Be aware that this will only work as expected if a POSIX shell can be found in the host environment, which is not always the case on windows.

See the section of the readme about task types for more details.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@adam2392
Comment options

Answer selected by adam2392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #93 on September 26, 2022 20:25.