Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-node
Commits
842ff9c2
Commit
842ff9c2
authored
12 years ago
by
Anael Beutot
Browse files
Options
Downloads
Patches
Plain Diff
Handles SIGCHLD for remote shell
parent
13fc5780
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cloudcontrol/node/host/__init__.py
+13
-2
13 additions, 2 deletions
cloudcontrol/node/host/__init__.py
with
13 additions
and
2 deletions
cloudcontrol/node/host/__init__.py
+
13
−
2
View file @
842ff9c2
...
...
@@ -90,6 +90,7 @@ class RemoteShell(object):
self
.
proto
=
conn
.
create_tunnel
(
endpoint
=
self
.
endpoint
,
on_shutdown
=
self
.
on_tunnel_shutdown
)
self
.
conn
=
conn
self
.
child_watcher
=
None
try
:
self
.
process
=
subprocess
.
Popen
(
[
exec_
],
stdout
=
self
.
slave
,
...
...
@@ -104,6 +105,9 @@ class RemoteShell(object):
# close opened fds
self
.
close_cb
()
raise
self
.
child_watcher
=
conn
.
loop
.
child
(
self
.
process
.
pid
,
False
,
self
.
child_cb
)
self
.
child_watcher
.
start
()
@property
def
label
(
self
):
...
...
@@ -121,11 +125,18 @@ class RemoteShell(object):
self
.
close
()
logger
.
debug
(
'
Tunnel closed by sjRPC
'
)
def
child_cb
(
self
,
watcher
,
revents
):
logger
.
debug
(
'
Tunnel closed by process termination
'
)
self
.
process
.
returncode
=
watcher
.
rstatus
self
.
close
()
def
close
(
self
):
if
self
.
process
.
poll
()
is
None
:
if
self
.
child_watcher
is
not
None
:
self
.
child_watcher
.
stop
()
self
.
child_watcher
=
None
if
self
.
process
.
returncode
is
None
:
# process is still alive
self
.
process
.
kill
()
self
.
process
.
wait
()
if
self
.
master
is
not
None
:
try
:
os
.
close
(
self
.
master
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment