mirror of
https://github.com/powerline/powerline.git
synced 2025-07-27 07:44:36 +02:00
Use posix.environ in Python client if available
This way there will be no need in converting keys and values to bytes objects on \*nix systems.
This commit is contained in:
parent
5434852977
commit
7871cfcda4
@ -5,8 +5,12 @@ from __future__ import (unicode_literals, division, absolute_import, print_funct
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import socket
|
import socket
|
||||||
import os
|
|
||||||
import errno
|
import errno
|
||||||
|
import os
|
||||||
|
try:
|
||||||
|
from posix import environ
|
||||||
|
except ImportError:
|
||||||
|
from os import environ
|
||||||
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
@ -69,7 +73,7 @@ else:
|
|||||||
args.append(cwd)
|
args.append(cwd)
|
||||||
|
|
||||||
|
|
||||||
args.extend((tobytes(k) + b'=' + tobytes(v) for k, v in os.environ.items()))
|
args.extend((tobytes(k) + b'=' + tobytes(v) for k, v in environ.items()))
|
||||||
|
|
||||||
EOF = b'\0\0'
|
EOF = b'\0\0'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user