-
Notifications
You must be signed in to change notification settings - Fork 49
/
ci.php
30 lines (30 loc) · 854 Bytes
/
ci.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
// import from clearsky/ci-test
$time = time();
$port = rand(1000,60000);
while(system("lsof -i:".$port) != null){
$port = rand(1000,60000);
}
echo "port is ".$port.PHP_EOL;
system("echo \"server-port=".$port."\" > server.properties");
system("echo \"DevTools=on\" > bluelight.properties");
$server = proc_open(PHP_BINARY . " src/pocketmine/PocketMine.php --no-wizard --disable-readline", [
0 => ["pipe", "r"],
1 => ["pipe", "w"],
2 => ["pipe", "w"]
], $pipes);
fwrite($pipes[0], "version\nmakeserver\nstop\n\n");
while(!feof($pipes[1]) and time()-$time<60*3){
echo fgets($pipes[1]);
}
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
echo "\n\nReturn value: ". proc_close($server) ."\n";
if(count(glob("plugins/DevTools/*.phar")) === 0){
echo "No server phar created!\n";
exit(1);
}else{
echo "Server phar created!\n";
exit(0);
}