Skip to content

ConsoleReaderChildProcessUtils ​

final class · pocketmine\console\ConsoleReaderChildProcessUtils · source

Constants ​

TOKEN_DELIMITER ​

php
public const TOKEN_DELIMITER = ":"

TOKEN_HASH_ALGO ​

php
public const TOKEN_HASH_ALGO = "xxh3"

Methods ​

createMessage() ​

php
public static function createMessage(string $line, int &$counter) : string

Creates an IPC message to transmit a user's input command to the parent process.

Unfortunately we can't currently provide IPC pipes other than stdout/stderr to subprocesses on Windows, so this adds a hash of the user input (with a counter as salt) to prevent unintended process output (like error messages) from being treated as user input.

parseMessage() ​

php
public static function parseMessage(string $message, int &$counter) : ?string

Extracts a command from an IPC message from the console reader subprocess. Returns the user's input command, or null if this isn't a user input.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.