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
salt-lint crash when piped and having non-beakable space in outputted line #74
Comments
Fun fact:
|
I reproduced the problem with this sample state:
there should be a strange character like a non-breakable space in
|
Thanks @sblaisot for the detailed bug report! Adding a rule for such characters is actually a great idea, it will reduces the time having to spend on searching for an invisible bug. In addition to adding a new rule we also have to make sure that |
Fix encoding to use utf-8 by default in Python 2, the default encoding in Python 3 is already utf-8. This fix will wrap `sys.stdout` in a object that automatically encodes an unicode string into utf-8, in Python 2 only. An alternative to this would be to set the `PYTHONIOENCODING='utf-8'` environment variable before running `salt-lint`, but this would require an extra action on the user side. The old solution using `str.encode('utf-8')` caused byte string (e.g. `b''`) output in Python 3... Fixes #74. Signed-off-by: Roald Nefs <roald@warpnet.nl>
Fix encoding to use utf-8 by default in Python 2, the default encoding in Python 3 is already utf-8. This fix will wrap `sys.stdout` in a object that automatically encodes an unicode string into utf-8, in Python 2 only. An alternative to this would be to set the `PYTHONIOENCODING='utf-8'` environment variable before running `salt-lint`, but this would require an extra action on the user side. The old solution using `str.encode('utf-8')` caused byte string (e.g. `b''`) output in Python 3... Fixes #74. Signed-off-by: Roald Nefs <roald@warpnet.nl>
Fix encoding to use utf-8 by default in Python 2, the default encoding in Python 3 is already utf-8. This fix will wrap `sys.stdout` in a object that automatically encodes an unicode string into utf-8, in Python 2 only. An alternative to this would be to set the `PYTHONIOENCODING='utf-8'` environment variable before running `salt-lint`, but this would require an extra action on the user side. The old solution using `str.encode('utf-8')` caused byte string (e.g. `b''`) output in Python 3... Fixes #74. Signed-off-by: Roald Nefs <roald@warpnet.nl>
Fix encoding to use utf-8 by default in Python 2, the default encoding in Python 3 is already utf-8. This fix will wrap `sys.stdout` in a object that automatically encodes an unicode string into utf-8, in Python 2 only. An alternative to this would be to set the `PYTHONIOENCODING='utf-8'` environment variable before running `salt-lint`, but this would require an extra action on the user side. The old solution using `str.encode('utf-8')` caused byte string (e.g. `b''`) output in Python 3... Fixes #74. Signed-off-by: Roald Nefs <roald@warpnet.nl>
I just encountered the following:
Not sure now what triggers the problem. I'm inestigating.
It's probably due to a bad character in the sls file + salt-lint output piped to something else which disables pretty color. Not seen it with direct output without pipe.
Will add additionnal information here as soon as I can reproduce it consistently.
The text was updated successfully, but these errors were encountered: