The issue is that this code assumes all files will have a creation time, while that's not true on Linux.
This commit makes no behavioral change if retrieving creation time is successful, but changes the error path to instead fall back to modified time if the creation time is missing (instead of erroring out).
When attempting to re-run the example script from the README in a podman container (Alpine Linux 3.17) I receive the following output:
In the container
~/.cache/
is on afuse-overlayfs
, which doesn't seem to expose file creation (called "Birth") time information:This seems to be introduced by the change here: https://github.com/fornwall/rust-script/commit/ab77a62efaf4e6e55300f44128f919b50b3eadd4#diff-42cb6807ad74b3e201c5a7ca98b911c5fa08380e942be6e4ac5807f8377f87fcR364-R366
The issue is that this code assumes all files will have a creation time, while that's not true on Linux.
This commit makes no behavioral change if retrieving creation time is successful, but changes the error path to instead fall back to modified time if the creation time is missing (instead of erroring out).