-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
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
Passing file descriptors to Eleventy #3574
Comments
I am noticing several of those (but this is an unrelated issue). Given that Eleventy tends to require fewer and fewer packages over the versions I'm positive we can find a solution to this. |
On my Debian Linux, when I log https://github.com/11ty/eleventy/blob/v3.0.0/cmd.cjs#L33 I can see that So I created a small test file var argv = require("minimist")(process.argv.slice(2));
console.log(argv); in the spirit of the official example and run it with I don't see anything specific to handle file descriptors in Minimist's codebase. |
The Programmatic API shows the same behaviour: import Eleventy from "@11ty/eleventy"
let elev = new Eleventy("/dev/fd/63");
await elev.write(); invoked with That's going to be a nice rabbit hole to go down to! (After dinner) |
TL;DR: fast-glob cannot see the file descriptor. import fg from "fast-glob";
const entries = await fg(["/dev/fd/63"]);
console.log(entries); Long version
https://github.com/11ty/eleventy/blob/v3.0.0/src/Eleventy.js#L104
https://github.com/11ty/eleventy/blob/v3.0.0/src/Eleventy.js#L104
https://github.com/11ty/eleventy/blob/v3.0.0/src/Eleventy.js#L483
https://github.com/11ty/eleventy/blob/v3.0.0/src/Eleventy.js#L234
https://github.com/11ty/eleventy/blob/v3.0.0/src/Eleventy.js#L301
https://github.com/11ty/eleventy/blob/v3.0.0/src/Util/ProjectDirectories.js#L174
https://github.com/11ty/eleventy/blob/v3.0.0/src/Util/ProjectDirectories.js#L137
https://github.com/11ty/eleventy/blob/v3.0.0/src/Eleventy.js#L530
https://github.com/11ty/eleventy/blob/v3.0.0/src/TemplateWriter.js#L31 Now we're done with the initialisation side. Let's look at the write.
https://github.com/11ty/eleventy/blob/v3.0.0/src/Eleventy.js#L1256
https://github.com/11ty/eleventy/blob/v3.0.0/src/Eleventy.js#L1334
https://github.com/11ty/eleventy/blob/v3.0.0/src/TemplateWriter.js#L428
https://github.com/11ty/eleventy/blob/v3.0.0/src/TemplateWriter.js#L140
https://github.com/11ty/eleventy/blob/v3.0.0/src/EleventyFiles.js#L400
https://github.com/11ty/eleventy/blob/v3.0.0/src/EleventyFiles.js#L350
https://github.com/11ty/eleventy/blob/v3.0.0/src/FileSystemSearch.js#L55 And here we receive an empty array as a result which leads to 0 files written in the end. |
Yes, exactly, and it looks like the glob I mentioned is not part of the issue, indeed. When passed a file descriptor through process substitution, we end up with the following TemplateWriter object: Maybe we could do without all the globster action when a single file is passed? |
I believe it's because https://github.com/mrmlnc/fast-glob/blob/e60a9f5f09bc58a3b22b1d7fb767c25f62df0d07/src/providers/filters/entry.ts#L55 checks if it's a file and Node.js fs API (isFile) returns false although it will return true when isFIFO is called. This seems to have changed in 3.3.3, although it's not out yet. Here's the stacks:
I have also filed a bug report in their repo: mrmlnc/fast-glob#469 EDIT: It seems that it was intentionally fixed in 3.3.3: mrmlnc/fast-glob@bcfd7bb#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R475 |
Linux
Eleventy 3.0.0
npx @11ty/eleventy --input=<(echo "foo")
Yields:
[11ty] Wrote 0 files in 0.02 seconds (v3.0.0)
Which mostly translates to eleventy ignoring the input file.
As an analogy, the following works as is:
node -p 'fs.readFileSync(process.argv[1])' <(echo foo)
<Buffer 66 6f 6f 0a>
Looks like the programatic API has the same behavior, so it's most likely not related to Eleventy CLI.
The text was updated successfully, but these errors were encountered: