diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-24 03:09:17 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-24 03:09:17 +0900 |
| commit | c5fc34a106a706ac12925c4df273a926811d260b (patch) | |
| tree | 24e798c4a00b32aa1a1f155b705d02fba9895875 /crates/shirabe-external-packages/src/symfony/console/cursor.rs | |
| parent | b2b321a26f6a628ee8e6757eb8577613e2024e70 (diff) | |
| download | php-shirabe-c5fc34a106a706ac12925c4df273a926811d260b.tar.gz php-shirabe-c5fc34a106a706ac12925c4df273a926811d260b.tar.zst php-shirabe-c5fc34a106a706ac12925c4df273a926811d260b.zip | |
feat(process): redesign proc_* on PhpResource process handles
proc_open/proc_close/proc_get_status/proc_terminate represented the
process handle as a PhpMixed, which cannot hold a live child process or
its pipes, so they were stubs or todo!(). Model the handle as a new
PhpResource::Process variant and child pipes as a StreamBacking::Pipe,
with a native Descriptor enum for descriptorspec; proc_open now returns
io::Result and fills pipes as IndexMap<i64, PhpResource>.
Rewire the Symfony Process pipes and the Console terminal/cursor onto
the new types, removing the "PhpMixed cannot carry a PhpResource"
todo!()s. The remaining todo!()s are genuine syscall leaves
(proc_terminate signal delivery, stream_select, stream_set_blocking,
posix_kill, pty, fd>=3) left unimplemented since no syscall crate is
introduced.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/cursor.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/cursor.rs | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/cursor.rs b/crates/shirabe-external-packages/src/symfony/console/cursor.rs index 811553f..c36f9b5 100644 --- a/crates/shirabe-external-packages/src/symfony/console/cursor.rs +++ b/crates/shirabe-external-packages/src/symfony/console/cursor.rs @@ -181,31 +181,20 @@ impl Cursor { let is_tty_supported = if shirabe_php_shim::function_exists("proc_open") { *IS_TTY_SUPPORTED.get_or_init(|| { - let mut pipes = shirabe_php_shim::PhpMixed::Null; - shirabe_php_shim::php_truthy(&shirabe_php_shim::proc_open( + let mut pipes = indexmap::IndexMap::new(); + shirabe_php_shim::proc_open( "echo 1 >/dev/null", - &vec![ - shirabe_php_shim::PhpMixed::List(vec![ - shirabe_php_shim::PhpMixed::String("file".to_string()), - shirabe_php_shim::PhpMixed::String("/dev/tty".to_string()), - shirabe_php_shim::PhpMixed::String("r".to_string()), - ]), - shirabe_php_shim::PhpMixed::List(vec![ - shirabe_php_shim::PhpMixed::String("file".to_string()), - shirabe_php_shim::PhpMixed::String("/dev/tty".to_string()), - shirabe_php_shim::PhpMixed::String("w".to_string()), - ]), - shirabe_php_shim::PhpMixed::List(vec![ - shirabe_php_shim::PhpMixed::String("file".to_string()), - shirabe_php_shim::PhpMixed::String("/dev/tty".to_string()), - shirabe_php_shim::PhpMixed::String("w".to_string()), - ]), + &[ + shirabe_php_shim::Descriptor::File("/dev/tty".to_string(), "r".to_string()), + shirabe_php_shim::Descriptor::File("/dev/tty".to_string(), "w".to_string()), + shirabe_php_shim::Descriptor::File("/dev/tty".to_string(), "w".to_string()), ], &mut pipes, None, None, None, - )) + ) + .is_ok() }) } else { false |
