diff --git a/faststreams/stdout.nim b/faststreams/stdout.nim index beaccdd..d57aa5f 100644 --- a/faststreams/stdout.nim +++ b/faststreams/stdout.nim @@ -1,5 +1,13 @@ import outputs -let fsStdOut* {.threadvar.} = fileOutput(system.stdout) +var fsStdOut* {.threadvar.}: OutputStream + +proc initFsStdOut* = + ## This proc must be called in each thread where + ## the `fsStdOut` variable will be used. + if fsStdOut == nil: + fsStdOut = fileOutput(system.stdout) + +initFsStdOut()