-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
returns NaN for free and size, and '' for diskPath when powershell settings have been adjusted on the user's machine #23
Comments
I don't have permission to push a new branch, so here's the diff that shows the fix. I just added diff --git a/src/index.ts b/src/index.ts
index 27aafee..07a7e42 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -129,7 +129,9 @@ function checkDiskSpace(directoryPath: string, dependencies: Dependencies = {
driveData => {
// Only get the drive which match the path
const driveLetter = driveData[0]
- return directoryPath.toUpperCase().startsWith(driveLetter.toUpperCase())
+ // driveData[0] can be empty string if the user has modified settings related to powershell,
+ // causing true to be wrongly returned unless we explicitly check for that case
+ return driveLetter && directoryPath.toUpperCase().startsWith(driveLetter.toUpperCase())
},
{
diskPath: 0, |
@davidburson what powershell settings did you change? curious how to reproduce this |
@davidburson Now I also encounter the situation of returning 'NAN'. I would like to ask, after adding 'driveLetter &&', can I get the correct value? |
This will be fixed in the next release :) I've added a filter to ignore empty lines, should do the work. |
Now fixed in 3.4.0 |
Sorry for the very slow reply. I can't remember for sure, but here's the changed settings I found, in case it's helpful:
|
My powershell settings cause blank lines to be included
parsed
inmapOutput
, andfilter
does not remove them, sofiltered[0]
ends up being an empty string, which causes the invalid return value.I'll post a PR shortly.
The text was updated successfully, but these errors were encountered: