forked from osmocom/wireshark
test: fix sampleif.py on weird systems using Python 3.6 and older
Setting PYTHONIOENCODING=utf-8 would also work, but only if it is done for every test that could possibly invoke the extcap. Let's patch the script instead to force UTF-8 for its output encoding. Thanks to Greg for the suggestion at https://stackoverflow.com/a/4374457/427545 Change-Id: I2e39e65e49465392c5b077c8b13ed931073661fb Reviewed-on: https://code.wireshark.org/review/32868 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
27dd00b30c
commit
ec0ba4185a
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
import argparse, os, sys
|
||||
import argparse, codecs, os, sys
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
|
@ -39,6 +39,11 @@ def extcap_config():
|
|||
|
||||
|
||||
def main():
|
||||
# In Python 3.6 and older, the encoding of stdout depends on the locale.
|
||||
# Do not rely on that and force a sane encoding instead. Python 3.7 has
|
||||
# improved, see https://www.python.org/dev/peps/pep-0540/
|
||||
sys.stdout = codecs.getwriter('utf-8')(sys.stdout.detach())
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.extcap_interfaces:
|
||||
return extcap_interfaces()
|
||||
|
|
Loading…
Reference in New Issue