Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

dogwrap: decode process output as utf-8 #127

Merged
merged 1 commit into from
Feb 17, 2015

Conversation

pbitty
Copy link
Contributor

@pbitty pbitty commented Feb 3, 2015

This fixes the issue where dogwrap will crash when a process' stdout/stderr contains non-ascii characters, in most cases utf-8.

I was getting this error:

$ python -m dogshell.wrap 'echo "\xE2\x98\xA0"'
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Library/Python/2.7/site-packages/dogshell/wrap.py", line 155, in <module>
    main()
  File "/Library/Python/2.7/site-packages/dogshell/wrap.py", line 139, in main
    event_body = u''.join(event_body)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

With this change:

$ python -m dogshell.wrap 'echo "\xE2\x98\xA0"'

☠

@remh remh added this to the datadog-py milestone Feb 13, 2015
@yannmh
Copy link
Member

yannmh commented Feb 17, 2015

Thanks a lot @pbitty, I am merging it.

yannmh added a commit that referenced this pull request Feb 17, 2015
dogwrap: decode process output as utf-8
@yannmh yannmh merged commit f6a3ba5 into DataDog:master Feb 17, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants