-
Notifications
You must be signed in to change notification settings - Fork 21
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
If psdrive was created in a previous raw, it won't be found. #27
Comments
Do you think it is an issue of PowerSlim? I don't think so.... It is bug tracker but not discussion board. |
IMHO we can discuss it here. It is a triage. Nothing bad with it. |
IMHO it is PowerSlim issue. |
Alexander, I agree with you, seems like a PowerSlim issue! Looking into it right now! |
I have changed the last table:
The second raw is green. |
I see such code in PowerSlim and imho that's the reason why. if($s.StartsWith('function',$true,$null)){Set-Variable -Name Script__ -Value ($s -replace 'function\s+(.+)(?=\()','function global:$1') -Scope Global}
else{Set-Variable -Name Script__ -Value ($s -replace '\$(\w+)(?=\s*=)','$global:$1') -Scope Global} It looks like w/o such code variables are local to the script. |
Alexander, here is the temporary fix for you: !|script|
|check|eval|New-PSDrive -PSProvider FileSystem -name test1 -root c:\test -Scope Global||
|check|eval|$res2=gc test1:file1.txt -last 1||
|check|eval|$res2|5| See this parameter -Scope Global |
Mike, thanks a lot for explanation. |
I created such test page:
!|script|
|eval|mkdir c:\test|
|eval|1..5 > c:\test\file1.txt|
!|script|
|eval|New-PSDrive -PSProvider FileSystem -name test -root c:\test;$res1 = gc test:file1.txt -last 1|
|check|eval|$res1|5|
!|script|
|eval|New-PSDrive -PSProvider FileSystem -name test -root c:\test|
|eval|$res2=gc test:file1.txt -last 1|
|check|eval|$res2|5|
the first check is successful, but second one is not. Output Captured returns an error:
gc : Cannot find drive. A drive with the name 'test' does not exist.
The text was updated successfully, but these errors were encountered: