@php-wasm/web-8-1 3.1.20 → 3.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/jspi/php_8_1.js CHANGED
@@ -7017,7 +7017,11 @@ export function init(RuntimeName, PHPLoader) {
7017
7017
  stdoutParentFd = std[1]?.parent,
7018
7018
  stderrChildFd = std[2]?.child,
7019
7019
  stderrParentFd = std[2]?.parent;
7020
+ const detachPipeDataListeners = [];
7020
7021
  cp.on('exit', function (code) {
7022
+ for (const detach of detachPipeDataListeners) {
7023
+ detach();
7024
+ }
7021
7025
  for (const fd of [stdoutChildFd, stderrChildFd, stdinChildFd]) {
7022
7026
  if (FS.streams[fd] && !FS.isClosed(FS.streams[fd])) {
7023
7027
  FS.close(FS.streams[fd]);
@@ -7029,30 +7033,46 @@ export function init(RuntimeName, PHPLoader) {
7029
7033
  if (stdoutChildFd) {
7030
7034
  const stdoutStream = SYSCALLS.getStreamFromFD(stdoutChildFd);
7031
7035
  let stdoutAt = 0;
7032
- cp.stdout.on('data', function (data) {
7033
- stdoutStream.stream_ops.write(
7034
- stdoutStream,
7035
- data,
7036
- 0,
7037
- data.length,
7038
- stdoutAt
7039
- );
7040
- stdoutAt += data.length;
7041
- });
7036
+ const onStdoutData = function (data) {
7037
+ try {
7038
+ stdoutStream.stream_ops.write(
7039
+ stdoutStream,
7040
+ data,
7041
+ 0,
7042
+ data.length,
7043
+ stdoutAt
7044
+ );
7045
+ stdoutAt += data.length;
7046
+ } catch {
7047
+ cp.stdout.off('data', onStdoutData);
7048
+ }
7049
+ };
7050
+ cp.stdout.on('data', onStdoutData);
7051
+ detachPipeDataListeners.push(() =>
7052
+ cp.stdout.off('data', onStdoutData)
7053
+ );
7042
7054
  }
7043
7055
  if (stderrChildFd) {
7044
7056
  const stderrStream = SYSCALLS.getStreamFromFD(stderrChildFd);
7045
7057
  let stderrAt = 0;
7046
- cp.stderr.on('data', function (data) {
7047
- stderrStream.stream_ops.write(
7048
- stderrStream,
7049
- data,
7050
- 0,
7051
- data.length,
7052
- stderrAt
7053
- );
7054
- stderrAt += data.length;
7055
- });
7058
+ const onStderrData = function (data) {
7059
+ try {
7060
+ stderrStream.stream_ops.write(
7061
+ stderrStream,
7062
+ data,
7063
+ 0,
7064
+ data.length,
7065
+ stderrAt
7066
+ );
7067
+ stderrAt += data.length;
7068
+ } catch {
7069
+ cp.stderr.off('data', onStderrData);
7070
+ }
7071
+ };
7072
+ cp.stderr.on('data', onStderrData);
7073
+ detachPipeDataListeners.push(() =>
7074
+ cp.stderr.off('data', onStderrData)
7075
+ );
7056
7076
  }
7057
7077
  try {
7058
7078
  await new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/web-8-1",
3
- "version": "3.1.20",
3
+ "version": "3.1.22",
4
4
  "description": "PHP 8.1 WebAssembly binaries for web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,11 +35,11 @@
35
35
  "node": ">=20.10.0",
36
36
  "npm": ">=10.2.3"
37
37
  },
38
- "gitHead": "98cfca0a050ef1dacce25710d6ebdf816e80b764",
38
+ "gitHead": "04c986b63dd56fe74e4ed0cf04d00cae7ac050bf",
39
39
  "dependencies": {
40
40
  "ini": "4.1.2",
41
41
  "wasm-feature-detect": "1.8.0",
42
- "@php-wasm/universal": "3.1.20"
42
+ "@php-wasm/universal": "3.1.22"
43
43
  },
44
44
  "packageManager": "npm@10.9.2",
45
45
  "overrides": {