RamblingCookieMonster / Invoke-Parallel

Speed up PowerShell with simplified multithreading
MIT License
384 stars 88 forks source link

Log file locks if multiple scripts invoke-parallel #48

Closed MKletz closed 7 years ago

MKletz commented 7 years ago

We have a script box that is running many scripts on a schedule and we run into situations where scripts that run on the same schedule using invoke-parallel will fail due to "The process cannot access the file 'C:\temp\log.log' because it is being used by another process." Can we make the log file optional with a switch? I've made the following edit to the copy we run.

[Parameter(Mandatory=$false)] [validatescript({Test-Path (Split-Path $_ -parent)})] [string]$LogFile,

MKletz commented 7 years ago

I attempted a pull request but it looks like there's an issue with the test importing pester. @RamblingCookieMonster

RamblingCookieMonster commented 7 years ago

Yikes! Agreed, that should be optional, and could use mutex support when used.

I haven't touched the build in a long time, good chance anything broken is on my side. I'll look into it!

Cheers!

MKletz commented 7 years ago

Awesome thanks!

RamblingCookieMonster commented 7 years ago

I'm closing this out for now, merged the PR. If someone wants to have fun with mutexes for folks who are running into locked log file, and really want that log file, feel free to open another issue.

Cheers!