Created
February 19, 2019 03:03
-
-
Save Viridovics/d2ca8d9c0bb7aadd8bc9073aa8f1284b to your computer and use it in GitHub Desktop.
SyncRoot for withFakeContext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let withFakeContextSyncRoot = new obj() | |
let withFakeContext name f = | |
lock withFakeContextSyncRoot (fun () -> | |
use execContext = Fake.Core.Context.FakeExecutionContext.Create false (sprintf "text.fsx - %s" name) [] | |
Fake.Core.Context.setExecutionContext (Fake.Core.Context.RuntimeContext.Fake execContext) | |
try f () | |
finally | |
Fake.Core.Context.removeExecutionContext() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment