Skip to content
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

touch fails when running in strict mode #22

Open
kimbirkelund opened this issue Jul 25, 2018 · 1 comment
Open

touch fails when running in strict mode #22

kimbirkelund opened this issue Jul 25, 2018 · 1 comment

Comments

@kimbirkelund
Copy link
Contributor

kimbirkelund commented Jul 25, 2018

Most of my scripts calls Set-StrictMode -Version Latest; initially, and I've noticed that touch fails in this mode:

Set-StrictMode -Version Latest; 
touch <file>

The property 'A' cannot be found on this object. Verify that the property exists.     
At ...\touch.ps1:45 char:4                          
+ if($opts.A) {                                                                       
+    ~~~~~~~                                                                          
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : PropertyNotFoundStrict                                  

This can either be fixed by not accessing hashtable contents as members, but using the indexer, or by calling Set-StrictMode -Off at the beginning of the file.

Hope you fix this as I love your tools :-) And I'd be happy to make a PR with the change you'd prefer.

@lukesampson
Copy link
Owner

Thanks, I'd be happy to accept a PR. Set-StrictMode -Off sounds good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants