We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup:
mkdir has_named_pipe mkfifo has_named_pipe/named_pipe
File a.c:
a.c
#include <sys/types.h> #include <dirent.h> #include <stdio.h> #ifdef __EMSCRIPTEN__ #include <emscripten.h> #endif int count_entries(char* dirname) { DIR* d = opendir(dirname); struct dirent *ep; int res = 0; while (1) { ep = readdir(d); if (ep == NULL) { break; } res ++; printf("%s\n", ep->d_name); } return res; } int main() { #ifdef __EMSCRIPTEN__ EM_ASM({ FS.mount(NODEFS, { root: 'has_named_pipe' }, 'has_named_pipe'); }); #endif int nentries = count_entries("has_named_pipe"); printf("nentries: %d\n", nentries); return 0; }
If we compile and run with gcc we get:
$ gcc a.c $ ./a.out named_pipe . .. nentries: 3
If we compile and run with emcc we get:
$ emcc a.c -lnodefs.js $ node a.out.js nentries: 0
Indeed after we see the named pipe, getdents stops reading. An error is thrown here: https://github.com/emscripten-core/emscripten/blob/main/src/library_nodefs.js?plain=1#L71 which aborts the normal handling. I think we can just ignore these entries?
getdents
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.72-git (b2ced9de42ea8028233d7d3588c45ce837b61185) clang version 20.0.0git (https:/github.com/llvm/llvm-project 50866e84d1da8462aeb96607bf6d9e5bbd5869c5) Target: wasm32-unknown-emscripten Thread model: posix
The text was updated successfully, but these errors were encountered:
I'm a little confused by the output "0" in the failing case... should that be nentries: 0 or is the zero coming from somewhere else?
nentries: 0
Sorry, something went wrong.
Yes it should be nentries: 0, edited it.
Successfully merging a pull request may close this issue.
Setup:
File
a.c
:If we compile and run with gcc we get:
If we compile and run with emcc we get:
Indeed after we see the named pipe,
getdents
stops reading. An error is thrown here: https://github.com/emscripten-core/emscripten/blob/main/src/library_nodefs.js?plain=1#L71 which aborts the normal handling. I think we can just ignore these entries?Version of emscripten/emsdk:
The text was updated successfully, but these errors were encountered: