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

amphp/process 1.x on Windows: Trying to start a non-existent executable gets stuck forever #71

Open
MatmaRex opened this issue Feb 21, 2024 · 2 comments
Labels

Comments

@MatmaRex
Copy link

MatmaRex commented Feb 21, 2024

Hi, I couldn't find information anywhere whether the 1.x branch is still maintained. If it isn't, my apologies for bothering you.

I found that trying to start a non-existent executable using amphp/process 1.x gets stuck forever on Windows. Minimal example:

<?php

require "vendor/autoload.php";

use Amp\Process\Process;
use function Amp\Promise\wait;

$process = new Process("asdfasdf");
$pid = wait($process->start());

This seems to be a very similar problem to #51, and the patch proposed there (Nicodinus@3d41ea5) fixes it for me.

@MatmaRex
Copy link
Author

(I ran into this problem while working on phpactor/phpactor#2551.)

MatmaRex added a commit to MatmaRex/phpactor that referenced this issue Feb 22, 2024
Shells other than Bash may not have an `export` builtin command
(in particular it doesn't exist on Windows). Shells are icky anyway.
Let's make our own in one line of PHP.

I'm doing this as the first patch towards making PHPUnit pass on
Windows, because trying to run a command that doesn't exist triggers
a really unpleasant bug in amphp/process 1.x on Windows, where it
hangs forever: amphp/process#71

(I had to move `$process->getStdout()` before `$process->join()`,
otherwise that would also hang forever. No idea why.)
MatmaRex added a commit to MatmaRex/phpactor that referenced this issue Feb 22, 2024
Shells other than Bash may not have an `export` builtin command
(in particular it doesn't exist on Windows). Shells are icky anyway.
Let's make our own in one line of PHP.

I'm doing this as the first patch towards making PHPUnit pass on
Windows, because trying to run a command that doesn't exist triggers
a really unpleasant bug in amphp/process 1.x on Windows, where it
hangs forever: amphp/process#71

(I had to move `$process->getStdout()` before `$process->join()`,
otherwise that would also hang forever. No idea why.)
MatmaRex added a commit to MatmaRex/phpactor that referenced this issue Feb 22, 2024
Shells other than Bash may not have an `export` builtin command
(in particular it doesn't exist on Windows). Shells are icky anyway.
Let's make our own in one line of PHP.

I'm doing this as the first patch towards making PHPUnit pass on
Windows, because trying to run a command that doesn't exist triggers
a really unpleasant bug in amphp/process 1.x on Windows, where it
hangs forever: amphp/process#71

(I had to move `$process->getStdout()` before `$process->join()`,
otherwise that would also hang forever. No idea why.)
dantleech pushed a commit to phpactor/phpactor that referenced this issue Feb 23, 2024
* ProcessBuilderTest: Don't depend on `export` shell builtin

Shells other than Bash may not have an `export` builtin command
(in particular it doesn't exist on Windows). Shells are icky anyway.
Let's make our own in one line of PHP.

I'm doing this as the first patch towards making PHPUnit pass on
Windows, because trying to run a command that doesn't exist triggers
a really unpleasant bug in amphp/process 1.x on Windows, where it
hangs forever: amphp/process#71

(I had to move `$process->getStdout()` before `$process->join()`,
otherwise that would also hang forever. No idea why.)

* StartCommandTest: Use TCP mode instead of standard input

Otherwise it tries to read from standard input, which is blocking on
Windows.
@MatmaRex
Copy link
Author

I've noticed that you just released 1.1.5, so I take it that it's maintained. I hope you don't mind if I send a pull request, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants