Skip to content

Commit 8ac28d2

Browse files
committed
Remove the restriction which allows only directory mounting during compilation
1 parent 6619235 commit 8ac28d2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/php-wasm/compile/php/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,9 @@ RUN set -euxo pipefail; \
21432143
# stream.stream_ops is sometimes undefined and the check fails. Let's adjust it to
21442144
# tolerate a null stream.stream_ops value.
21452145
/root/replace.sh "s/if\s*\(stream\.stream_ops\.poll\)/if (stream.stream_ops?.poll)/g" /root/output/php.js; \
2146+
# Emscriptend allows only directories to be mounted, but in Playground we support mounting files, directories, and symlinks.
2147+
# For file mounting to work, we need to remove the directory check.
2148+
/root/replace-across-lines.sh 's/(\s+)if\s*\(\s*!FS\.isDir\(node\.mode\)\s*\)\s*\{\s+throw\s+new\s+FS\.ErrnoError\(54\)\s*;\s+\}(\s+)/$1$2/gs' /root/output/php.js; \
21462149
# Make Emscripten websockets configurable
21472150
# Emscripten makes the Websocket proxy connect to a fixed URL.
21482151
# This assumes the traffic is always forwarded to the same target.
@@ -2153,9 +2156,9 @@ RUN set -euxo pipefail; \
21532156
# Enable custom WebSocket constructors to support socket options.
21542157
/root/replace.sh "s/ws\s*=\s*new WebSocketConstructor/if (Module['websocket']['decorator']) {WebSocketConstructor = Module['websocket']['decorator'](WebSocketConstructor);}ws = new WebSocketConstructor/g" /root/output/php.js && \
21552158
if [ "$EMSCRIPTEN_ENVIRONMENT" = "node" ]; then \
2156-
if [ "$WITH_WS_NETWORKING_PROXY" = "yes" ]; then \
2157-
/root/replace.sh "s/sock\.server\s*=\s*new WebSocketServer/if (Module['websocket']['serverDecorator']) {WebSocketServer = Module['websocket']['serverDecorator'](WebSocketServer);}sock.server = new WebSocketServer/g" /root/output/php.js; \
2158-
fi; \
2159+
if [ "$WITH_WS_NETWORKING_PROXY" = "yes" ]; then \
2160+
/root/replace.sh "s/sock\.server\s*=\s*new WebSocketServer/if (Module['websocket']['serverDecorator']) {WebSocketServer = Module['websocket']['serverDecorator'](WebSocketServer);}sock.server = new WebSocketServer/g" /root/output/php.js; \
2161+
fi; \
21592162
fi; \
21602163
# Add MSG_PEEK flag support in recvfrom
21612164
#

0 commit comments

Comments
 (0)