+
Skip to content

check50._api.run returns stdout+stderr #247

Open
@pazz

Description

@pazz

Hi!
I've recently noticed some unexpected behaviour when running check50_.api.run on some command that outputs both to stdout (which I want as string) and stderr (which I want to ignore). I get both.

I am running this command:

 java -jar /home/pazz/.local/lib/python3.9/site-packages/check50_checkstyle/lib/checkstyle-8.39-all.jar -c naming-conventions.xml -f xml *.java

where the output on stdout is some XML report that I parse:

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="8.39">
<file name="/home/pazz/repo/teaching/2021-COMP122/content/lectures/code/l9a/EmptyGUI.java">
</file>
<file name="/home/pazz/repo/teaching/2021-COMP122/content/lectures/code/l9a/Gui.java">
<error line="3" column="42" severity="error" message="Array brackets at illegal position." source="com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck"/>
</file>
<file name="/home/pazz/repo/teaching/2021-COMP122/content/lectures/code/l9a/LabelFrame.java">
</file>
<file name="/home/pazz/repo/teaching/2021-COMP122/content/lectures/code/l9a/NoLayout.java">
</file>
</checkstyle>

plus a summary (which I cannot suppress)

Checkstyle ends with 1 errors.

When I run this using the check50 API i get the concatenation as sole string result:

<?xml version="1.0" encoding="UTF-8"?>\n<checkstyle version="8.39">\n<file name="/tmp/tmpd2chxmcv/checkstyle_naming_conventings/EmptyGUI.java">\n</file>\n<file name="/tmp/tmpd2chxmcv/checkstyle_naming_conventings/Gui.java">\n<error line="3" column="42" severity="error" message="Array brackets at illegal position." source="com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck"/>\n</file>\n<file name="/tmp/tmpd2chxmcv/checkstyle_naming_conventings/LabelFrame.java">\n</file>\n<file name="/tmp/tmpd2chxmcv/checkstyle_naming_conventings/NoLayout.java">\n</file>\n</checkstyle>\nCheckstyle ends with 1 errors.\n

A hotfix for me is to append " 2>/dev/null" to the command, but this is obviously ugly and may only work as long as check50 uses a shell to interpret these commands.

Question/feature request: can we have a parameter to _api.run that allows to supress stdout?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载