Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proc_open failed because Pty is not supported in Swoole #5275

Closed
bosunski opened this issue Mar 14, 2024 · 0 comments
Closed

proc_open failed because Pty is not supported in Swoole #5275

bosunski opened this issue Mar 14, 2024 · 0 comments

Comments

@bosunski
Copy link

Please answer these questions before submitting your issue.

  1. What did you do? If possible, provide a simple script for reproducing the error.

When I run this code:

<?php
Swoole\Runtime::setHookFlags(SWOOLE_HOOK_ALL);
Swoole\Coroutine\run(function () {
    $descriptorspec = [
        ['pty'],
        ['pty'],
        ['pty'],
    ];
    $process = proc_open(["echo", "1"], $descriptorspec, $pipes);

    var_dump($pipes);

    var_dump(fread($pipes[2], 8192));

    $return_value = proc_close($process);

    echo "command returned $return_value\n";
});

I got a warning and the process failed to start:

PHP Warning:  proc_open(): pty pseudo terminal not supported on this system

When I ran the same code without Swoole, it worked fine

<?php

$descriptorspec = [
  ['pty'],
  ['pty'],
  ['pty'],
];
$process = proc_open(["echo", "1"], $descriptorspec, $pipes);

var_dump($pipes);

var_dump(fread($pipes[2], 8192));

$return_value = proc_close($process);

echo "command returned $return_value\n";
  1. What did you expect to see?

Running process should work fine without warning and output 1

  1. What did you see instead?
PHP Warning:  proc_open(): pty pseudo terminal not supported on this system
  1. What version of Swoole are you using (show your php --ri swoole)?
swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.0.3
Built => Sep 26 2023 16:42:34
coroutine => enabled with boost asm context
kqueue => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 3.1.3 19 Sep 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
zlib => 1.2.12
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 262144 => 262144
  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
Darwin XXXXX-MacBook-Pro.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64
PHP 8.2.16 (cli) (built: Feb 13 2024 15:22:59) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.16, Copyright (c) Zend Technologies
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
matyhtf added a commit that referenced this issue Mar 27, 2024
@matyhtf matyhtf closed this as completed in 4a73486 Apr 9, 2024
@matyhtf matyhtf added the fixed label Apr 9, 2024
matyhtf added a commit that referenced this issue Apr 10, 2024
* support pty, fix #5275

* fix

* fix 2

* fix

* fix BC

* fix tests
matyhtf added a commit that referenced this issue May 9, 2024
* Optimize code

* thread local

* swoole thread

* optimize argv

* optimize code, add more methods for thread

* Swoole\Thread\Map

* Swoole\Thread\ArrayList

* Optimize

* zend_array

* Optimize

* Optimize

* Optimize

* fix

* remove co redis/mysql/pgsql client

* Added Thread\Queue

* Fix Thread\Queue

* fix mem leak

* optimize, reduce memory copy

* Revert "optimize, reduce memory copy"

This reverts commit 449adf9.

* optimize code, remove 8.0 supports

* refactor atomic/lock, support thread

* clang-format

* fix tests

* [6.0] Server for thread mode (#5282)

* http server for thread mode

* fix compile error

* optimize code

* optimize code

* optimize code[2]

* optimize code[3]

* optimize code[4]

* refactor co-socket, support thread

* add signal example

---------

Co-authored-by: NathanFreeman <1056159381@qq.com>

* Update version

* Optimize header

* Fix

* refactor async-threads, support ZTS

* Optimize

* Optimize

* Optimize

* Optimize

* Optimize 5

* Optimize 6

* Optimize 7

* Optimize 8

* Optimize 10

* Optimize 11, add Server::get_worker_id()

* Optimize 12

* Optimize 13

* Optimize 14

* rename

* Refactor

* Refactor 2

* revert , format

* onPipeMessage/onTask/onFinish, fix message bus

* Update README.md

* Added pty support for proc_open function, fix #5275 (#5290)

* support pty, fix #5275

* fix

* fix 2

* fix

* fix BC

* fix tests

* Update boost asm (#5291)

* update boost asm

* Fix error

* fix tests

* fix tests

* fix tests

* remove hiredis

* fix tests [3]

* fix tests [4]

* fix tests [5], revert SwooleWG

* fix tests [6]

* fix tests [7]

* fix tests [8]

* optimize tests

* add thread test

* fix ci

* [test] fix ci 2

* [test] fix ci 3

* [test] fix ci 4

* [test] fix ci 5

* [test] fix ci 6

* [test] fix ci 7

* [test] fix ci 8

* [test] fix ci 9

* [test] fix ci 10

* [test] fix ci 11

* [test] remove swoole_timer_set, async settings can only be set in the main thread

* optimize create socket (#5293)

* optimize create socket

* fix error

* optimize code

* [test] fix tests

* [test] fix tests [3]

* [test] fix tests [4]

* sync plain_wrapper (#5296)

* [test] fix tests [5]

* No limit on the maximum buffer length of the read pipeline

* Refactor

* fix

* optimize tests

* fix tests

* code format

* fix tests

* fix tests

* fix tests [3]

* Fix transfer_t struct missing (#5303)

* Fix missing transfer_t

* Fix missing transfer_t

* Optimize thread context

* Fix tests[4]

* Refactor

* Refactor

* Refactor

* fix server shutdown

* fix thread atomic

* fix core tests

* Fix Sqlite pdo segmentfault (#5311)

* fix pdo

* fix sqlite error

* fix sqlite error

* fix sqlite error

* fix core tests

* Support passing streams between threads

* Support using stream as a thread argument

* optimize code

* optimize code

---------

Co-authored-by: NathanFreeman <1056159381@qq.com>
Co-authored-by: MARiA so cute <33935209+NathanFreeman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants