Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7197eaebf2
commit
9c0f8de791
15771 changed files with 1564103 additions and 5 deletions
165
vendor/symfony/console/Helper/TerminalInputHelper.php
vendored
Normal file
165
vendor/symfony/console/Helper/TerminalInputHelper.php
vendored
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
/**
|
||||
* TerminalInputHelper stops Ctrl-C and similar signals from leaving the terminal in
|
||||
* an unusable state if its settings have been modified when reading user input.
|
||||
* This can be an issue on non-Windows platforms.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* $inputHelper = new TerminalInputHelper($inputStream);
|
||||
*
|
||||
* ...change terminal settings
|
||||
*
|
||||
* // Wait for input before all input reads
|
||||
* $inputHelper->waitForInput();
|
||||
*
|
||||
* ...read input
|
||||
*
|
||||
* // Call finish to restore terminal settings and signal handlers
|
||||
* $inputHelper->finish()
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class TerminalInputHelper
|
||||
{
|
||||
/** @var resource */
|
||||
private $inputStream;
|
||||
private bool $isStdin;
|
||||
private string $initialState = '';
|
||||
private int $signalToKill = 0;
|
||||
private array $signalHandlers = [];
|
||||
private array $targetSignals = [];
|
||||
private bool $withStty;
|
||||
|
||||
/**
|
||||
* @param resource $inputStream
|
||||
*
|
||||
* @throws \RuntimeException If unable to read terminal settings
|
||||
*/
|
||||
public function __construct($inputStream, bool $withStty = true)
|
||||
{
|
||||
$this->inputStream = $inputStream;
|
||||
$this->isStdin = 'php://stdin' === stream_get_meta_data($inputStream)['uri'];
|
||||
$this->withStty = $withStty;
|
||||
|
||||
if ($withStty) {
|
||||
if (!\is_string($state = shell_exec('stty -g'))) {
|
||||
throw new \RuntimeException('Unable to read the terminal settings.');
|
||||
}
|
||||
|
||||
$this->initialState = trim($state);
|
||||
|
||||
$this->createSignalHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for input.
|
||||
*/
|
||||
public function waitForInput(): void
|
||||
{
|
||||
if ($this->isStdin) {
|
||||
$r = [$this->inputStream];
|
||||
$w = [];
|
||||
|
||||
// Allow signal handlers to run
|
||||
while (0 === @stream_select($r, $w, $w, 0, 100)) {
|
||||
$r = [$this->inputStream];
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->withStty) {
|
||||
$this->checkForKillSignal();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores terminal state and signal handlers.
|
||||
*/
|
||||
public function finish(): void
|
||||
{
|
||||
if (!$this->withStty) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Safeguard in case an unhandled kill signal exists
|
||||
$this->checkForKillSignal();
|
||||
|
||||
// The captured "stty -g" state is not guaranteed to be accepted back by "stty" on every
|
||||
// platform/terminal (e.g. some nested pty implementations reject it with "invalid argument"),
|
||||
// and shell_exec() gives no way to detect that failure. Try the exact restore first so
|
||||
// any custom terminal settings survive, but always fall back to "stty sane" so the
|
||||
// terminal is left in a usable state even when the exact restore silently fails.
|
||||
shell_exec('stty '.$this->initialState.' 2>/dev/null || stty sane');
|
||||
$this->signalToKill = 0;
|
||||
|
||||
foreach ($this->signalHandlers as $signal => $originalHandler) {
|
||||
pcntl_signal($signal, $originalHandler);
|
||||
}
|
||||
$this->signalHandlers = [];
|
||||
$this->targetSignals = [];
|
||||
}
|
||||
|
||||
private function createSignalHandlers(): void
|
||||
{
|
||||
if (!\function_exists('pcntl_async_signals') || !\function_exists('pcntl_signal')) {
|
||||
return;
|
||||
}
|
||||
|
||||
pcntl_async_signals(true);
|
||||
$this->targetSignals = [\SIGINT, \SIGQUIT, \SIGTERM];
|
||||
|
||||
foreach ($this->targetSignals as $signal) {
|
||||
$this->signalHandlers[$signal] = pcntl_signal_get_handler($signal);
|
||||
|
||||
pcntl_signal($signal, function ($signal) {
|
||||
// Save current state, then restore to initial state. The original signal
|
||||
// handler is about to run, so fall back to "stty sane" if the exact restore
|
||||
// is rejected by "stty" (see the same fallback in finish()), to make sure it
|
||||
// runs with a usable terminal.
|
||||
$currentState = shell_exec('stty -g');
|
||||
shell_exec('stty '.$this->initialState.' 2>/dev/null || stty sane');
|
||||
$originalHandler = $this->signalHandlers[$signal];
|
||||
|
||||
if (\is_callable($originalHandler)) {
|
||||
$originalHandler($signal);
|
||||
// Handler did not exit, so restore to current state
|
||||
shell_exec('stty '.$currentState);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Not a callable, so SIG_DFL or SIG_IGN
|
||||
if (\SIG_DFL === $originalHandler) {
|
||||
$this->signalToKill = $signal;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private function checkForKillSignal(): void
|
||||
{
|
||||
if (\in_array($this->signalToKill, $this->targetSignals, true)) {
|
||||
// Try posix_kill
|
||||
if (\function_exists('posix_kill')) {
|
||||
pcntl_signal($this->signalToKill, \SIG_DFL);
|
||||
posix_kill(getmypid(), $this->signalToKill);
|
||||
}
|
||||
|
||||
// Best attempt fallback
|
||||
exit(128 + $this->signalToKill);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue