-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Allow PowerShell to start even if Data, Home, and Cache folders cannot be created #3244
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While extremely unlikely - this test could cause spurious failures, if for example a background process installed a new module between runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would sufficient to just check it's greater than 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check can be removed - it would be redundantly checked in QueueSerialization and it will rarely be true, so the extra code isn't saving anything in the normal case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered this originally and perhaps over optimizing for avoiding a function call. I'll remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check can also be removed, though it wouldn't hurt to assert here.
The design is that nobody can call Serialize without going through QueueSerialization, so the check isn't needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove and add assert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't thought through the implications - but should we have a fallback? e.g. $env:TEMP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This usage is an edge case, I'm not sure how much we want to optimize particularly as one can use the XDG_*_HOME env vars. Also, I don't think it's guaranteed the user account has write access to $env:TEMP so we'd have to check that anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What sort of contract should this api have? If the directory can't be used, should this api return null instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path.Combine() is used often with this api and would have a problem with null. My thinking was that this api returns the expected path which may be used in error message, so even returning an empty string may produce undesired results.
… scenarios that don't have home directories Removed redundant checks if saving to analysis cache Updated test to avoid race condition where a module is added in between checks addresses PowerShell#3011 Removed unnecessary check to save to disk
5fdcbd2 to
aa2edb7
Compare
Allow Directory Creation failures to continue for Service Account use scenarios that don't have home directories
addresses #3011