Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b23110f2
Commit
b23110f2
authored
Jan 10, 2008
by
msvensson@pilot.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auto kill any children before exiting from process
parent
d610b721
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
mysql-test/lib/My/SafeProcess.pm
mysql-test/lib/My/SafeProcess.pm
+20
-0
No files found.
mysql-test/lib/My/SafeProcess.pm
View file @
b23110f2
...
...
@@ -85,6 +85,24 @@ BEGIN {
}
}
END
{
# Kill any children still running
for
my
$proc
(
values
%
running
){
if
(
$proc
->
is_child
(
$$
)
){
print
"
Killing:
$proc
\n
";
$proc
->
kill
();
}
}
}
sub
is_child
{
my
(
$self
,
$parent_pid
)
=
@_
;
die
"
usage:
\
$safe_proc
->is_child()
"
unless
(
@_
==
2
and
ref
$self
);
return
(
$self
->
{
PARENT
}
==
$parent_pid
);
}
# Find the safe process binary or script
my
@safe_process_cmd
;
my
$safe_kill
;
...
...
@@ -172,6 +190,7 @@ sub new {
SAFE_WINPID
=>
$winpid
,
SAFE_NAME
=>
$name
,
SAFE_SHUTDOWN
=>
$shutdown
,
PARENT
=>
$$
,
},
$class
);
# Put the new process in list of running
...
...
@@ -203,6 +222,7 @@ sub timer {
({
SAFE_PID
=>
$pid
,
SAFE_NAME
=>
"
timer
",
PARENT
=>
$$
,
},
$class
);
# Put the new process in list of running
...
...
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