New issue
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
differences in output between -pipe and and input puml file prints ERROR #155
Comments
Hi,
Hope it helps!
Well, the ouput messages are different because the input is different. When using Printing a path with But it's not because we do not print path using
I understand your need. Maybe it's time for us to add some level of trace. The default level would be the actual one, but we can think about a |
Thanks for the detailed explanation about -pipe. My concern should have been clearer. my "working" code looks like this: def generate_png(self, input, output):
command = self.java_jar + self.puml + " -v " + input + " -o " + self.output_dir
pprint("I am going to run the following command: " + command +
". This is so that I can verify that no errors will occur on the build that will publish everyones diagrams")
p_generate = subprocess.Popen(
[command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
retval = p_generate.wait()
stdout_lines = p_generate.stdout.readlines()
pprint(stdout_lines)
if retval > 0:
pprint("I think some thing is wrong with your file - very likely a syntax error, check the generated file if there was one per the log above")
return retval
error_hints = ['error', 'errors', 'Error', 'Errors', 'cannot', 'Found 0 files',
'Exception', 'Warning: no image in']
matching = [s for s in stdout_lines if any(
xs in s for xs in error_hints)]
if len(matching) > 0:
pprint("I found a message that indicates a failure: " +
'\n'.join(matching))
retval = 1
return retval my gripe is with these lines that are printed out only when -pipe is used:
ERROR is printed out, I assume the 0 is the return value. I can't depend on the error code because a file not found returns 0 - I want it to return 1. Per the above printout from the output of -pipe I can't depend on "ERROR" either. I have tried to work around it by grepping all the log.error and looking for messages that I think I would care about. Then Log.info also has "error" in its text. the calling code looks like this - for completeness def test_generate_png_syntax_error():
pre_commit = Pre_Commit(
'./plantuml.jar',
'./temp')
retval = pre_commit.generate_png(
'./alice_syntax_error.puml', './temp')
assert_equals(retval, 1) |
Thanks also for your explanation, it's more clear for us too! Unfortunately we cannot change the actual behavior of the command line because some plugins really depend on this, and will be break by any change. However, we agree that it's time to design the command line interface, so we come with a proposal. In last beta http://beta.plantuml.net/plantuml.jar we've added a new flag
This is printed whether you use the You really should not use However, once it will be fully specified, Tell us if some information are missing for you, we will add them. |
Thank you for the heads up about verbose (I think it is helpful to tell the user why I decided to get in the way of their work). The KVP is easier to read and parse. I am using openjdk so I can't build your code. I have an issue similar to #69 while attempting to build - I can probably find a oracle jdk on a docker container.
Error line 2 in file: ./inventorysales.puml
The exit code is good
Using the same file with the same error in pipe
notice the missing lines in bold above. I think it's polite to tell the consumer everything they need to do to fix the problem. In this case I misspelled participant The exit code is good
|
From the original post I do not understand why this is an error
exit code
|
closing no longer at the company that this was a problem for |
Hi @arnaudroques -- Is this related to qjebbs/vscode-plantuml#265 ? When a diagram is previewed without having You can try it yourself with the VSCode extension for plantuml (it's very cool). |
Using pipe the output looks like this
$ echo -e "@startuml\nAlice -> Bob: test\n@enduml\n" | java -Djava.awt.headless=true -jar plantuml.jar -v -pipe > alice.png
Using a file input makes no difference
$ echo -e "@startuml\nAlice -> Bob: test\n@enduml\n" > alice.puml
$ cat alice.puml | java -Djava.awt.headless=e -jar ./plantuml.jar -v -pipe > alice.png
Using the same file as an input
$ java -Djava.awt.headless=true -jar ./plantuml.jar -v alice.puml
In each of the above cases the png is generated and it renders.
Is there a reason why the output messages need to be different? I only care about this because I am parsing errors in python for a git hook and would like a way to test the error conditions in my tests. It would be nice to not have to create a file per test.
You do seem to be able to generate a diagram with the @startuml tags when pipe is used and not when it is an input file - is this desired behavior?
$ echo -e "Alice -> Bob: test\n" | java -Djava.awt.headless=true -jar ./plantuml.jar -v -pipe > alice.png
I have done some editing of the output as to hide the full path in the output
The text was updated successfully, but these errors were encountered: