@php-wasm/web-7-4 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_7_4.js CHANGED
@@ -7006,7 +7006,11 @@ export function init(RuntimeName, PHPLoader) {
7006
7006
  stdoutParentFd = std[1]?.parent,
7007
7007
  stderrChildFd = std[2]?.child,
7008
7008
  stderrParentFd = std[2]?.parent;
7009
+ const detachPipeDataListeners = [];
7009
7010
  cp.on('exit', function (code) {
7011
+ for (const detach of detachPipeDataListeners) {
7012
+ detach();
7013
+ }
7010
7014
  for (const fd of [stdoutChildFd, stderrChildFd, stdinChildFd]) {
7011
7015
  if (FS.streams[fd] && !FS.isClosed(FS.streams[fd])) {
7012
7016
  FS.close(FS.streams[fd]);
@@ -7018,30 +7022,46 @@ export function init(RuntimeName, PHPLoader) {
7018
7022
  if (stdoutChildFd) {
7019
7023
  const stdoutStream = SYSCALLS.getStreamFromFD(stdoutChildFd);
7020
7024
  let stdoutAt = 0;
7021
- cp.stdout.on('data', function (data) {
7022
- stdoutStream.stream_ops.write(
7023
- stdoutStream,
7024
- data,
7025
- 0,
7026
- data.length,
7027
- stdoutAt
7028
- );
7029
- stdoutAt += data.length;
7030
- });
7025
+ const onStdoutData = function (data) {
7026
+ try {
7027
+ stdoutStream.stream_ops.write(
7028
+ stdoutStream,
7029
+ data,
7030
+ 0,
7031
+ data.length,
7032
+ stdoutAt
7033
+ );
7034
+ stdoutAt += data.length;
7035
+ } catch {
7036
+ cp.stdout.off('data', onStdoutData);
7037
+ }
7038
+ };
7039
+ cp.stdout.on('data', onStdoutData);
7040
+ detachPipeDataListeners.push(() =>
7041
+ cp.stdout.off('data', onStdoutData)
7042
+ );
7031
7043
  }
7032
7044
  if (stderrChildFd) {
7033
7045
  const stderrStream = SYSCALLS.getStreamFromFD(stderrChildFd);
7034
7046
  let stderrAt = 0;
7035
- cp.stderr.on('data', function (data) {
7036
- stderrStream.stream_ops.write(
7037
- stderrStream,
7038
- data,
7039
- 0,
7040
- data.length,
7041
- stderrAt
7042
- );
7043
- stderrAt += data.length;
7044
- });
7047
+ const onStderrData = function (data) {
7048
+ try {
7049
+ stderrStream.stream_ops.write(
7050
+ stderrStream,
7051
+ data,
7052
+ 0,
7053
+ data.length,
7054
+ stderrAt
7055
+ );
7056
+ stderrAt += data.length;
7057
+ } catch {
7058
+ cp.stderr.off('data', onStderrData);
7059
+ }
7060
+ };
7061
+ cp.stderr.on('data', onStderrData);
7062
+ detachPipeDataListeners.push(() =>
7063
+ cp.stderr.off('data', onStderrData)
7064
+ );
7045
7065
  }
7046
7066
  try {
7047
7067
  await new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/web-7-4",
3
- "version": "3.1.20",
3
+ "version": "3.1.22",
4
4
  "description": "PHP 7.4 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": {