You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/php-wasm/node/public/php_8_0.js
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -646,9 +646,9 @@ function __asyncjs__js_module_onMessage(data,response_buffer) { return Asyncify.
646
646
__asyncjs__js_module_onMessage.sig='iii';
647
647
function__asyncjs__js_popen_to_file(cmd,mode,exit_code_ptr){returnAsyncify.handleAsync(async()=>{if(!command)return1;constcmdstr=UTF8ToString(command);if(!cmdstr.length)return0;constmodestr=UTF8ToString(mode);if(!modestr.length)return0;if(modestr==='w'){console.error('popen($cmd, "w") is not implemented yet');}returnnewPromise(async(wakeUp)=>{letcp;try{cp=PHPWASM.spawnProcess(cmdstr,[]);if(cpinstanceofPromise){cp=awaitcp;}}catch(e){console.error(e);if(e.code==='SPAWN_UNSUPPORTED'){return1;}throwe;}constoutByteArrays=[];cp.stdout.on('data',function(data){outByteArrays.push(data);});constoutputPath='/tmp/popen_output';cp.on('exit',function(exitCode){constoutBytes=newUint8Array(outByteArrays.reduce((acc,curr)=>acc+curr.length,0));letoffset=0;for(constbyteArrayofoutByteArrays){outBytes.set(byteArray,offset);offset+=byteArray.length;}FS.writeFile(outputPath,outBytes);HEAPU8[exitCodePtr]=exitCode;wakeUp(allocateUTF8OnStack(outputPath));});});});}
648
648
__asyncjs__js_popen_to_file.sig='iiii';
649
-
function__asyncjs__wasm_poll_socket(socketd,events,timeout){returnAsyncify.handleAsync(async()=>{if(typeofAsyncify==='undefined'){return0;}constPOLLIN=0x0001;constPOLLPRI=0x0002;constPOLLOUT=0x0004;constPOLLERR=0x0008;constPOLLHUP=0x0010;constPOLLNVAL=0x0020;returnnewPromise((wakeUp)=>{constpolls=[];if(socketdinPHPWASM.child_proc_by_fd){constprocInfo=PHPWASM.child_proc_by_fd[socketd];if(procInfo.exited){wakeUp(0);return;}polls.push(PHPWASM.awaitEvent(procInfo.stdout,'data'));}elseif(FS.isSocket(stream.node.mode)){constsock=getSocketFromFD(socketd);if(!sock){wakeUp(0);return;}constlookingFor=newSet();if(events&POLLIN||events&POLLPRI){if(sock.server){for(constclientofsock.pending){if((client.recv_queue||[]).length>0){wakeUp(1);return;}}}elseif((sock.recv_queue||[]).length>0){wakeUp(1);return;}}constwebSockets=PHPWASM.getAllWebSockets(sock);if(!webSockets.length){wakeUp(0);return;}for(constwsofwebSockets){if(events&POLLIN||events&POLLPRI){polls.push(PHPWASM.awaitData(ws));lookingFor.add('POLLIN');}if(events&POLLOUT){polls.push(PHPWASM.awaitConnection(ws));lookingFor.add('POLLOUT');}if(events&POLLHUP){polls.push(PHPWASM.awaitClose(ws));lookingFor.add('POLLHUP');}if(events&POLLERR||events&POLLNVAL){polls.push(PHPWASM.awaitError(ws));lookingFor.add('POLLERR');}}}else{wakeUp(0);return;}if(polls.length===0){console.warn('Unsupported poll event '+events+', defaulting to setTimeout().');setTimeout(function(){wakeUp(0);},timeout);return;}constpromises=polls.map(([promise])=>promise);constclearPolling=()=>polls.forEach(([,clear])=>clear());letawaken=false;lettimeoutId;Promise.race(promises).then(function(results){if(!awaken){awaken=true;wakeUp(1);if(timeoutId){clearTimeout(timeoutId);}clearPolling();}});if(timeout!==-1){timeoutId=setTimeout(function(){if(!awaken){awaken=true;wakeUp(0);clearPolling();}},timeout);}});});}
649
+
function__asyncjs__wasm_poll_socket(socketd,events,timeout){returnAsyncify.handleAsync(async()=>{if(typeofAsyncify==='undefined'){return0;}constPOLLIN=0x0001;constPOLLPRI=0x0002;constPOLLOUT=0x0004;constPOLLERR=0x0008;constPOLLHUP=0x0010;constPOLLNVAL=0x0020;returnnewPromise((wakeUp)=>{constpolls=[];if(socketdinPHPWASM.child_proc_by_fd){constprocInfo=PHPWASM.child_proc_by_fd[socketd];if(procInfo.exited){wakeUp(0);return;}polls.push(PHPWASM.awaitEvent(procInfo.stdout,'data'));}elseif(FS.isSocket(FS.getStream(socketd)?.node.mode)){constsock=getSocketFromFD(socketd);if(!sock){wakeUp(0);return;}constlookingFor=newSet();if(events&POLLIN||events&POLLPRI){if(sock.server){for(constclientofsock.pending){if((client.recv_queue||[]).length>0){wakeUp(1);return;}}}elseif((sock.recv_queue||[]).length>0){wakeUp(1);return;}}constwebSockets=PHPWASM.getAllWebSockets(sock);if(!webSockets.length){wakeUp(0);return;}for(constwsofwebSockets){if(events&POLLIN||events&POLLPRI){polls.push(PHPWASM.awaitData(ws));lookingFor.add('POLLIN');}if(events&POLLOUT){polls.push(PHPWASM.awaitConnection(ws));lookingFor.add('POLLOUT');}if(events&POLLHUP){polls.push(PHPWASM.awaitClose(ws));lookingFor.add('POLLHUP');}if(events&POLLERR||events&POLLNVAL){polls.push(PHPWASM.awaitError(ws));lookingFor.add('POLLERR');}}}else{wakeUp(0);return;}if(polls.length===0){console.warn('Unsupported poll event '+events+', defaulting to setTimeout().');setTimeout(function(){wakeUp(0);},timeout);return;}constpromises=polls.map(([promise])=>promise);constclearPolling=()=>polls.forEach(([,clear])=>clear());letawaken=false;lettimeoutId;Promise.race(promises).then(function(results){if(!awaken){awaken=true;wakeUp(1);if(timeoutId){clearTimeout(timeoutId);}clearPolling();}});if(timeout!==-1){timeoutId=setTimeout(function(){if(!awaken){awaken=true;wakeUp(0);clearPolling();}},timeout);}});});}
0 commit comments