Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
47868511
Commit
47868511
authored
May 14, 2010
by
Pieter Noordhuis
Browse files
wait for redis-server to be settled and ready for connections
parent
1488645e
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/support/server.tcl
View file @
47868511
...
@@ -22,9 +22,9 @@ proc kill_server config {
...
@@ -22,9 +22,9 @@ proc kill_server config {
# kill server and wait for the process to be totally exited
# kill server and wait for the process to be totally exited
exec kill $pid
exec kill $pid
while 1
{
while 1
{
# with a non-zero exit status, the process is gone
if
{[
catch
{
exec ps -p $pid | grep redis-server
}
result
]}
{
if
{[
catch
{
exec ps -p $pid | grep redis-server
}
result
]}
{
# non-zero exis status, process is gone
break
break
;
}
}
after 10
after 10
}
}
...
@@ -79,6 +79,14 @@ proc start_server {filename overrides {code undefined}} {
...
@@ -79,6 +79,14 @@ proc start_server {filename overrides {code undefined}} {
error_and_quit $config_file $line
error_and_quit $config_file $line
}
}
while 1
{
# check that the server actually started and is ready for connections
if
{[
exec cat $stdout | grep
"ready to accept"
| wc -l
]
> 0
}
{
break
}
after 10
}
# find out the pid
# find out the pid
regexp
{
^
\[
(
\d
+
)
\]
}
[
exec head -n1 $stdout
]
_ pid
regexp
{
^
\[
(
\d
+
)
\]
}
[
exec head -n1 $stdout
]
_ pid
...
...
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