parallel processing - PowerShell: How to write to a file from multiple jobs? -


okay, here's pseudo-code of i'm trying do:

function dothings() {    $onejob = {     ### things...     # want capture stdout *and* stderr of these 3 commands     a_command >> "logfile.log" 2>&1     b_command >> "logfile.log" 2>&1     c_command >> "logfile.log" 2>&1     }    $params = @{ }    ($i=1; $i -lt 100; $i++)  {     ### manipulate $params here     start-job $onejob -argumentlist $params     }    } 

however, naively running above resulted in several jobs ending errors, because apparently "logfile.log" being opened job running @ same time.

so, how ensure jobs not step on each other's shoes when writing "logfile.log" file?


Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -