Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
8ec800fe
Commit
8ec800fe
authored
Jul 20, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some issues with the destruction of half-created processes
parent
08ad1a96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/netns/subprocess_.py
src/netns/subprocess_.py
+8
-4
No files found.
src/netns/subprocess_.py
View file @
8ec800fe
...
...
@@ -55,6 +55,10 @@ class Subprocess(object):
argv
=
[
argv
]
if
shell
:
argv
=
[
'/bin/sh'
,
'-c'
]
+
argv
# Initialize attributes that would be used by the destructor if spawn
# fails
self
.
_pid
=
self
.
_returncode
=
None
# confusingly enough, to go to the function at the top of this file,
# I need to call it thru the communications protocol: remember that
# happens in another process!
...
...
@@ -63,7 +67,6 @@ class Subprocess(object):
cwd
=
cwd
,
env
=
env
,
user
=
user
)
node
.
_add_subprocess
(
self
)
self
.
_returncode
=
None
@
property
def
pid
(
self
):
...
...
@@ -106,17 +109,17 @@ class Subprocess(object):
def
__del__
(
self
):
self
.
destroy
()
def
destroy
(
self
):
if
self
.
_returncode
!=
None
:
if
self
.
_returncode
!=
None
or
self
.
_pid
==
None
:
return
self
.
signal
()
now
=
time
.
time
()
while
time
.
time
()
-
now
<
KILL_WAIT
:
if
self
.
poll
():
if
self
.
poll
()
!=
None
:
return
time
.
sleep
(
0.1
)
sys
.
stderr
.
write
(
"WARNING: killing forcefully process %d.
\
n
"
%
self
.
_pid
)
self
.
signal
(
signal
.
KILL
)
self
.
signal
(
signal
.
SIG
KILL
)
self
.
wait
()
PIPE
=
-
1
...
...
@@ -137,6 +140,7 @@ class Popen(Subprocess):
"""
self
.
stdin
=
self
.
stdout
=
self
.
stderr
=
None
self
.
_pid
=
self
.
_returncode
=
None
fdmap
=
{
"stdin"
:
stdin
,
"stdout"
:
stdout
,
"stderr"
:
stderr
}
# if PIPE: all should be closed at the end
for
k
,
v
in
fdmap
.
items
():
...
...
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