-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
Webpack crushes when tries to print a message about donating in Windows 8.1 #962
Comments
When building on a windows machine, the build fails due to recent changes to the bin/cli.js
It relies on process.getuid which is not available on windows. Should probably revert the change done in comit Alternatively, find a way to not rely on a non windows available function. |
Sounds weird but for keep in dev, i just change my date to not Monday and now it's not crashing cause of this: if (now.getDay() === MONDAY) { 😕 ❓ |
@Riguidix const openCollectivePath = __dirname + "/opencollective.js";
const MONDAY = 1;
const SIX_DAYS = 518400000;
const now = new Date();
if (now.getDay() === MONDAY) {
const { access, constants, statSync, utimesSync } = require("fs");
const stat = statSync(openCollectivePath);
const lastPrint = stat.atime;
const fileOwnerId = stat.uid;
const lastPrintTS = new Date(lastPrint).getTime();
const timeSinceLastPrint = now.getTime() - lastPrintTS;
if (timeSinceLastPrint > SIX_DAYS) {
require(openCollectivePath);
// On windows we need to manually update the atime
// Updating utime requires process owner is as same as file owner
access(openCollectivePath, constants.W_OK, e => {
if (!e && fileOwnerId === process.getuid()) utimesSync(openCollectivePath, now, now);
});
}
} the inner logic is only triggered if it's a monday, and if timeSinceLastPrint is larger than six_days. This is the old source const now = new Date();
if (now.getDay() === MONDAY) {
const { access, constants, statSync, utimesSync } = require("fs");
const lastPrint = statSync(openCollectivePath).atime;
const lastPrintTS = new Date(lastPrint).getTime();
const timeSinceLastPrint = now.getTime() - lastPrintTS;
if (timeSinceLastPrint > SIX_DAYS) {
require(openCollectivePath);
// On windows we need to manually update the atime
access(openCollectivePath, constants.W_OK, e => {
if (!e) utimesSync(openCollectivePath, now, now);
});
}
} I would purpose something closer to that. const now = new Date();
if (now.getDay() === MONDAY) {
const { access, constants, statSync, utimesSync } = require("fs");
const lastPrint = statSync(openCollectivePath).atime;
const lastPrintTS = new Date(lastPrint).getTime();
const timeSinceLastPrint = now.getTime() - lastPrintTS;
if (timeSinceLastPrint > SIX_DAYS) {
require(openCollectivePath);
// On windows we need to manually update the atime
access(openCollectivePath, constants.W_OK, e => {
if (!e) {
try {
utimesSync(openCollectivePath, now, now);
} catch() {}
}
});
}
} Is it the prettiest code ever written? Nope! If that would be the case, all of the logic could pretty much be deleted. Thoughts? |
Could you submit a PR? |
Nope. Someone else who usually works with webpack-cli should be able to fix this issue in a matter of minutes. |
@evenstensberg I think the only fix for this issue is to remove that condition |
Pls post stable version number |
Latest version is the one |
Yeah, I have the same problem. I change computer time, it is working. |
I got same error when I used Math.Round function. npm install or npm update doesn't fix that problem, but change computer time did. |
Guys, have you tried the latest version? 3.3.5? |
This is insane. I understand that you rely on donations to keep things floating but having this kind of logic to show a donation message is madness. Currently I'm hit by this bug and without downgrading my builds are broken until tomorrow. Someone should really rethink if this is the most effective way to get donations (while I rethink if webpack should be kept in our toolchain). |
I don't think that's true @ext . We initially toned down the way we outputted donation messages because people said it was annoying to output every time they install webpack (and that is what every other tool asking for donations is doing right now). If you install the newest version, the donation banner is gone. Let me know if there's anymore troubles... |
Same on windows 10, upgrading to 3.3.5 fixed it. |
Getting the same thing today on both 3.3.4 and 3.3.5 on windows 10 Setting the time back seems to fix it
|
Updating to 3.3.5 fixed it for me. Thanks |
3.3.5 solved the problem. |
Closing as |
based |
@prahladyeri I'm not sure what you're going on about. The point of this logic, as stated, is to reduce the frequency of the messages. Is your actual complaint here that Webpack is asking for donations at all? Also, donations are voluntary, nothing is being "extracted". |
This reminds me of OpenOffice Cannot Print on Tuesdays... |
@joepie91 Never mind, I've deleted that comment. My point is that CLI programs (especially) shouldn't be coded with such zero day if conditions which can fail on specific days. Console based programs are highly used on production web servers where such failed conditions might result in failed builds or even considerable downtime (which didn't happen in this case, thankfully). I call these conditions sneaky because its not possible to easily test their outcomes in the usual course of unit testing. |
Fix: upgrade to webpack-cli v.3.3.5. I'm sorry if this has caused you harm in any way. |
What is the current behavior?
Webpack-cli crushes:
To Reproduce
Steps to reproduce the behavior:
npx webpack --config webpack.config.js --mode development
on MondayExpected behavior
It should not to stop a webpack process
Versions
webpack: 4.33.0
webpack-cli: 3.3.3
nodejs: 12.4.0
OS: Windows 8.1
The text was updated successfully, but these errors were encountered: