pipe output of command into file

Issue #73 on hold
Former user created an issue

Hi together,

I need to pipe the output of pylint into a file, so the Jenkins violations plugin can check it later, but unfortunately:

commands = 
    pylint --rcfile=.pylintrc implib2 |tee pylint.out

gives me this error:

|tee:1: [F] No module named |tee


commands = 
    pylint --rcfile=.pylintrc implib2 > pylint.out

gives me this error:

>:1: [F] No module named >

For now I put the pylint command into the (bash) build command of jenkins, but it would be nice if I could put this into my tox.ini file.

Cheers, Markus

Comments (12)

  1. Holger Krekel repo owner

    tox doesn't implement shell semantics (it wouldn't easily work on windows). Can you instruct pylint with an option to write the output somewhere?

  2. Former user Account Deleted

    Yes I can, but unfortunately it seems the only way to instruct pylint to write something into a file, is via the "files-output" option, but this results in a couple of files. Luckily the jenkins violations plugin can also handle this situation, by specifying a search wildcard like this: **/pylint_**.txt

    But nevertheless I think it would be a nice feature to generally be able to collect the output of a command into a file.

  3. Rob van der Linde

    flake8 have since added the --output-file option which has saved me in the end, but would it really be that hard to add support for a small amount of pipe characters (> and |, maybe >>)... Windows supports these too.

  4. Holger Krekel repo owner

    If you feel that adding support for redirection to files or pipes is easy, please submit a PR.

  5. Dan Helfman

    Here's a work-around for this issue:

    commands =
        bash -c \'pylint --rcfile=.pylintrc implib2 |tee pylint.out\'

    It's not pretty, but it works.

  6. Log in to comment