Skip to content

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Jul 5, 2025

Motivation for the change, related issues

Description TBD.

With this PR, we can use the Symfony Process component. It spawns a new process via proc_open(), marks its output stream as non-blocking, and immediately reads the initial output bytes if any are present. Before this change, Playground would block until the first output is produced, and, sometimes until the entire process finishes.

Implementation details

Testing Instructions (or ideally a Blueprint)

@@ -344,6 +344,8 @@ EM_JS(__wasi_errno_t, js_fd_read, (__wasi_fd_t fd, const __wasi_iovec_t *iov, si
}

const success = returnCode === 0;
// @TODO: Do not reason about child_proc_by_fd. Just use pipes and detect
Copy link
Collaborator Author

@adamziel adamziel Jul 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, PHP uses that distinction internally, so maybe it's not a problem at all? Although we operate at the kernel level here.

https://github.com/php/php-src/blob/004cb827501d1ddaf98daacb185a53e0816f78a7/main/streams/plain_wrapper.c#L476

if (data->is_process_pipe) {
	errno = 0;
	ret = pclose(data->file);

#if HAVE_SYS_WAIT_H
	if (WIFEXITED(ret)) {
		ret = WEXITSTATUS(ret);
	}
#endif
} else {
	ret = fclose(data->file);
	data->file = NULL;
}

@adamziel
Copy link
Collaborator Author

superseded by #2339

@adamziel adamziel closed this Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant