Error: EISDIR: illegal operation on a directory, fstat
Hello! Great work on this project by the way.
In reference to #17 where the writes to stdout and stderr were returning 31.
Looks like
const stat = (wasi, fd) => {
...
const stats = fs.fstatSync(entry.real);
...
};
Seems to be the trouble on windows. :)
When the file descriptor is 0, 1 or 2, it looks like an error code EISDIR is thrown because it's not an actual file descriptor on windows.
Perhaps there is a good way this can be fixed? I could help submit a pull request.
If someone on windows wants to fix this I will gladly accept a PR.
Alternatively, a better solution might be to change fds 0, 1, and 2 to be streams, which would allow overriding them in the wasi constructor. This would also mean the defaults can be process.stdin and such so we wouldn't need to worry about platform specifics.