Skip to content

Instantly share code, notes, and snippets.

@Viridovics
Created February 19, 2019 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Viridovics/d2ca8d9c0bb7aadd8bc9073aa8f1284b to your computer and use it in GitHub Desktop.
Save Viridovics/d2ca8d9c0bb7aadd8bc9073aa8f1284b to your computer and use it in GitHub Desktop.
SyncRoot for withFakeContext
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