git://git.onelab.eu
/
nepi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
locally executed commands need to set universal_newlines too in py3
[nepi.git]
/
nepi
/
util
/
execfuncs.py
diff --git
a/nepi/util/execfuncs.py
b/nepi/util/execfuncs.py
index
a78ef39
..
a8591f8
100644
(file)
--- a/
nepi/util/execfuncs.py
+++ b/
nepi/util/execfuncs.py
@@
-22,6
+22,8
@@
import logging
import shlex
import subprocess
import shlex
import subprocess
+from six import PY2
+
def lexec(command,
user = None,
sudo = False,
def lexec(command,
user = None,
sudo = False,
@@
-42,10
+44,12
@@
def lexec(command,
#elif user:
# command = "su %s ; %s " % (user, command)
#elif user:
# command = "su %s ; %s " % (user, command)
+ extras = {} if PY2 else {'universal_newlines' : True}
proc = subprocess.Popen(command,
proc = subprocess.Popen(command,
- shell = True,
- stdout = subprocess.PIPE,
- stderr = subprocess.PIPE)
+ shell = True,
+ stdout = subprocess.PIPE,
+ stderr = subprocess.PIPE,
+ **extras)
out = err = ""
log_msg = "lexec - command %s " % command
out = err = ""
log_msg = "lexec - command %s " % command
@@
-78,9
+82,11
@@
def lcopy(source, dest, recursive = False):
else:
args.append(dest)
else:
args.append(dest)
+ extras = {} if PY2 else {'universal_newlines' : True}
proc = subprocess.Popen(args,
proc = subprocess.Popen(args,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ **extras)
out = err = ""
command = " ".join(args)
out = err = ""
command = " ".join(args)