diff --git a/doc/api/process.md b/doc/api/process.md index 7c29ceefbcbe73..5f866e3139aa4d 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -954,6 +954,11 @@ emitMyWarning(); + +* {symbol} + +A special value that can be passed as the `env` option of the [`Worker`][] +constructor, to indicate that the current thread and the Worker thread should +share read and write access to the same set of environment variables. + +```js +const { Worker, SHARE_ENV } = require('worker_threads'); +new Worker('process.env.SET_IN_WORKER = "foo"', { eval: true, env: SHARE_ENV }) + .on('exit', () => { + console.log(process.env.SET_IN_WORKER); // Prints 'foo'. + }); +``` + ## worker.threadId