- if {$code ne "undefined" && ![ping_server $::host $::port]} {
- error_and_quit $config_file [exec cat $stderr]
+ # ugly but tries to be as fast as possible...
+ if {$::valgrind} {set retrynum 1000} else {set retrynum 100}
+ set serverisup 0
+
+ if {$::verbose} {
+ puts -nonewline "=== ($tags) Starting server ${::host}:${::port} "
+ }
+
+ after 10
+ if {$code ne "undefined"} {
+ while {[incr retrynum -1]} {
+ catch {
+ if {[ping_server $::host $::port]} {
+ set serverisup 1
+ }
+ }
+ if {$serverisup} break
+ after 50
+ }
+ } else {
+ set serverisup 1
+ }
+
+ if {$::verbose} {
+ puts ""
+ }
+
+ if {!$serverisup} {
+ set err {}
+ append err [exec cat $stdout] "\n" [exec cat $stderr]
+ start_server_error $config_file $err
+ return