Comments (5)
Hi @WiredSharp.
Can you please send the text that is not parsed?
from robocopyps.
Hello,
here is an InputObject raising the previously mentioned error:
' 424 2022/10/11 13:40:54 E:\projects\Jee\lo.tools.jee\Tmp\modules\LO.Core\2.1.0\security\private\New-Credential2.ps1'
Notice that line has leading mix of tabs and spaces
BeforeDiscovery {
$ModuleName = 'RobocopyPS'
$ModuleBase = Split-Path -Parent $PSScriptRoot
$ModulePath = Join-Path $ModuleBase -ChildPath $ModuleName
# Removes all versions of the module from the session before importing
Get-Module $ModuleName | Remove-Module
Import-Module $ModulePath -PassThru -ErrorAction Stop
}
Describe "when parsing robocopy output" {
InModuleScope $ModuleName {
It "should not raise exception when parsing fails" -ForEach @(
@{ line = ' 424 2022/10/11 13:40:54 E:\projects\New-Credential2.ps1';Source='E:\projects\New-Credential2.ps1' }
) {
{ Invoke-RobocopyParser -InputObject $line } | Should -Not -Throw
}
}
}
from robocopyps.
Another case that will trigger this same code path occurs when specifying a logfile that resides inside the 'Source' directory.
(***Normally you wouldn't put the log in the source dir, but when copying a single file it's technically safe)
For example:
Invoke-Robocopy -Source "C:\tmp\src" -Destination "C:\tmp\dst" -Files "abc.txt" -LogFile "C:\tmp\src\robocopy.log" -Force
The first line of output from robocopy.exe is something akin to:
Log File : C:\tmp\src\robocopy.log
Because this log file line matches *$Source*
it enters the wrong branch and triggers the 'You cannot call a method on a null-valued expression.'
The offending line is here:
I've only briefly tested @WiredSharp's PR, but it seems to work perfectly and has also inadvertently solved this logfile bug!
from robocopyps.
Hi.
This is merged to master in Github, will push it to the Powershell Gallery as soon as possible. Thank you @WiredSharp for your help, much appreciated!
from robocopyps.
Hi.
This is now released to Powershell Gallery with version 0.2.19.
from robocopyps.
Related Issues (20)
- Issue when using special character on Source/Path
- PS v5: Issue using multiple paths in Get-RoboItem
- Parser fails to interpret hours more than 24:00:00 on long runs HOT 3
- Remove-RoboItem stops for input if robocopy fails to delete all sub items. HOT 4
- Remove-RoboItem is not using created temporary folder HOT 2
- Get-RoboItem with -Unit GB on small items gives weird TotalSize HOT 1
- Fix auto loading of module HOT 1
- Robocopy issue HOT 3
- Win11: Speed not parsed correctly
- differential backup HOT 1
- Incompatible with PowerShell 7.3+ HOT 3
- [Request] Add option to clear `$global:LastExitCode` on success HOT 1
- should use $WhatIfPreference rather than $WhatIf
- add function to append log
- add /v switch HOT 1
- create parametersetname
- Create example with Job options
- Fix Pester tests
- Add include/exclude files and directories to Get-RoboItem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robocopyps.