Added .BAT for async command I/O in one window

This commit is contained in:
Shoghi Cervantes Pueyo 2012-12-17 19:05:50 +01:00
parent adb795be22
commit 0086900469
3 changed files with 34 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,7 +1,6 @@
data/players/*
data/maps/*
*.log
*.bat
server.properties
white-list.txt
banned-ips.txt

View File

@ -27,5 +27,9 @@ the Free Software Foundation, either version 3 of the License, or
$fp = fopen(dirname(__FILE__)."/console.in","wb");
while(true){
echo "/";fwrite($fp, fgets(STDIN));
$l = fgets(STDIN);
fwrite($fp, $l);
if(strtolower(trim($l)) === "stop" and isset($argv[1]) and trim($argv[1]) == "1"){
sleep(5);die();
}
}

29
start.bat Normal file
View File

@ -0,0 +1,29 @@
@echo off
TITLE Pocket-Minecraft-PHP Server - by @shoghicp
echo.
echo -
echo / \
echo / \
echo / POCKET \
echo / MINECRAFT PHP \
echo ^|\ @shoghicp /^|
echo ^|. \ / .^|
echo ^| .. \ / .. ^|
echo ^| .. ^| .. ^|
echo ^| .. ^| .. ^|
echo \ ^| /
echo \ ^| /
echo \ ^| /
echo \ ^| /
echo.
echo.
FOR /F "tokens=*" %%i in ('php.exe -r "echo 1;"') do SET PHPOUTPUT=%%i
if not %PHPOUTPUT%==1 (
echo [ERROR] Couldn't find PHP in PATH.
pause
exit
)
START /B CMD /C CALL php server.php
START /B /WAIT php input.php 1
pause
exit