Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
b3491b19
Commit
b3491b19
authored
Oct 19, 2017
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: Lazy-format more logging arguments, minor 3.x compat increments
parent
0e7cc55e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
mitogen/master.py
mitogen/master.py
+24
-12
No files found.
mitogen/master.py
View file @
b3491b19
import
Queue
import
commands
import
dis
import
dis
import
errno
import
errno
import
getpass
import
getpass
...
@@ -22,6 +20,11 @@ import time
...
@@ -22,6 +20,11 @@ import time
import
types
import
types
import
zlib
import
zlib
try
:
import
Queue
except
ImportError
:
import
queue
as
Queue
if
not
hasattr
(
pkgutil
,
'find_loader'
):
if
not
hasattr
(
pkgutil
,
'find_loader'
):
# find_loader() was new in >=2.5, but the modern pkgutil.py syntax has
# find_loader() was new in >=2.5, but the modern pkgutil.py syntax has
# been kept intentionally 2.3 compatible so we can reuse it.
# been kept intentionally 2.3 compatible so we can reuse it.
...
@@ -51,13 +54,21 @@ def get_child_modules(path, fullname):
...
@@ -51,13 +54,21 @@ def get_child_modules(path, fullname):
return
[
'%s.%s'
%
(
fullname
,
name
)
for
_
,
name
,
_
in
it
]
return
[
'%s.%s'
%
(
fullname
,
name
)
for
_
,
name
,
_
in
it
]
def
format_cmdline
(
args
):
class
Argv
(
object
):
return
' '
.
join
(
def
__init__
(
self
,
argv
):
commands
.
mkarg
(
arg
).
strip
()
self
.
argv
=
argv
if
any
(
s
in
arg
for
s
in
(
" '
\
"
$"
))
else
arg
def
escape
(
self
,
x
):
for
arg
in
args
s
=
'"'
)
for
c
in
x
:
if
c
in
'
\
\
$"`'
:
s
+=
'
\
\
'
s
+=
c
s
+=
'"'
return
s
def
__str__
(
self
):
return
' '
.
join
(
map
(
self
.
escape
,
self
.
argv
))
def
create_child
(
*
args
):
def
create_child
(
*
args
):
...
@@ -73,7 +84,7 @@ def create_child(*args):
...
@@ -73,7 +84,7 @@ def create_child(*args):
childfp
.
close
()
childfp
.
close
()
LOG
.
debug
(
'create_child() child %d fd %d, parent %d, cmd: %s'
,
LOG
.
debug
(
'create_child() child %d fd %d, parent %d, cmd: %s'
,
pid
,
parentfp
.
fileno
(),
os
.
getpid
(),
format_cmdline
(
args
))
pid
,
parentfp
.
fileno
(),
os
.
getpid
(),
Argv
(
args
))
return
pid
,
os
.
dup
(
parentfp
.
fileno
())
return
pid
,
os
.
dup
(
parentfp
.
fileno
())
...
@@ -83,10 +94,11 @@ def flags(names):
...
@@ -83,10 +94,11 @@ def flags(names):
return
sum
(
getattr
(
termios
,
name
)
for
name
in
names
.
split
())
return
sum
(
getattr
(
termios
,
name
)
for
name
in
names
.
split
())
def
cfmakeraw
(
(
iflag
,
oflag
,
cflag
,
lflag
,
ispeed
,
ospeed
,
cc
)
):
def
cfmakeraw
(
flags
):
"""Given a list returned by :py:func:`termios.tcgetattr`, return a list
"""Given a list returned by :py:func:`termios.tcgetattr`, return a list
that has been modified in the same manner as the `cfmakeraw()` C library
that has been modified in the same manner as the `cfmakeraw()` C library
function."""
function."""
iflag
,
oflag
,
cflag
,
lflag
,
ispeed
,
ospeed
,
cc
=
flags
iflag
&=
~
flags
(
'IGNBRK BRKINT PARMRK ISTRIP INLCR IGNCR ICRNL IXON'
)
iflag
&=
~
flags
(
'IGNBRK BRKINT PARMRK ISTRIP INLCR IGNCR ICRNL IXON'
)
oflag
&=
~
flags
(
'OPOST IXOFF'
)
oflag
&=
~
flags
(
'OPOST IXOFF'
)
lflag
&=
~
flags
(
'ECHO ECHOE ECHONL ICANON ISIG IEXTEN'
)
lflag
&=
~
flags
(
'ECHO ECHOE ECHONL ICANON ISIG IEXTEN'
)
...
@@ -135,7 +147,7 @@ def tty_create_child(*args):
...
@@ -135,7 +147,7 @@ def tty_create_child(*args):
os
.
close
(
slave_fd
)
os
.
close
(
slave_fd
)
LOG
.
debug
(
'tty_create_child() child %d fd %d, parent %d, cmd: %s'
,
LOG
.
debug
(
'tty_create_child() child %d fd %d, parent %d, cmd: %s'
,
pid
,
master_fd
,
os
.
getpid
(),
format_cmdline
(
args
))
pid
,
master_fd
,
os
.
getpid
(),
Argv
(
args
))
return
pid
,
master_fd
return
pid
,
master_fd
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment