예제 #1
0
function start_realplexor()
{
    global $REALPLEXOR_CONF, $OUT_TMP, $OUT_TMP_FH;
    kill_realplexor();
    $OUT_TMP = tempnam('non-existent', '');
    if (pcntl_fork() == 0) {
        $filter = '
			$| = 1;
			s/\\s*\\[\\w\\w\\w\\s.*?\\]\\s*//sg;
			s/\\s*Opened files limit.*//mg;
			s/\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+:\\s*//sg;
			s/\\d+( bytes)/<N>$1/s;
			s/(appending configuration from ).*/$1***/mg;
			s/(\\[)\\d+\\.\\d+/$1*/sg;
			s/(events=)\\d+/$1*/sg;
			s/^/# /sg;
			if ($del) {
				$_ = "";
				$del--;
			}
		';
        $args = '';
        if ($REALPLEXOR_CONF) {
            $args = escapeshellarg(dirname(__FILE__) . '/fixture/' . $REALPLEXOR_CONF);
        }
        run("cd ../.. && perl dklab_realplexor.pl {$args} | tee -a {$OUT_TMP} " . "| perl -pe " . escapeshellarg($filter) . ($GLOBALS['VERBOSE'] ? "" : " | tail -n1"));
        exit;
    }
    expect('/listening 127.0.0.1/');
}
예제 #2
0
function start_realplexor()
{
    global $REALPLEXOR_CONF, $OUT_TMP, $OUT_TMP_FH, $IS_BIN, $DEBUG;
    kill_realplexor();
    $OUT_TMP = tempnam('non-existent', '');
    if (pcntl_fork() == 0) {
        if (!$DEBUG) {
            $filter = '
                $| = 1;
                /^Killed\\r?\\n/ and $del = 1;
                s/\\s*\\[\\w\\w\\w\\s.*?\\]\\s*//sg;
                s/\\s*Opened files limit.*//mg;
                s/\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+:\\s*//sg;
                s/\\?:\\?:\\s*//sg;
                s/\\r//sg;
                s/\\d+( bytes)/<N>$1/s;
                s/(appending configuration from ).*/$1***/mg;
                s/(\\[)\\d+\\.\\d+/$1*/sg;
                s/(events=)\\d+/$1*/sg;
                s/^/# /sg;
                if ($del) {
                    $_ = "";
                    $del--;
                }
            ';
        } else {
            $filter = '$| = 1';
        }
        if ($IS_BIN) {
            $exe = "./dklab_realplexor";
            $conf = $REALPLEXOR_CONF;
        } else {
            $exe = "perl dklab_realplexor.pl";
            $conf = $REALPLEXOR_CONF;
        }
        $args = '';
        if ($conf) {
            $args = escapeshellarg(dirname(__FILE__) . '/fixture/' . $conf);
        }
        // Run via "sh -c" to catch "Killed" message of killall.
        run("cd ../.. && sh -c '{$exe} {$args}' 2>&1 | tee -a {$OUT_TMP} " . "| perl -pe " . escapeshellarg($filter) . ($GLOBALS['VERBOSE'] ? "" : " | tail -n1"));
        exit;
    }
    expect('/Switching current user/');
}