Created
October 14, 2023 21:34
-
-
Save guest271314/e7035fb6717093af965b057a6888031b to your computer and use it in GitHub Desktop.
[Node.js] Write to stdout of current process pid
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
import { open } from "node:fs/promises"; | |
const stdout = await open(`/proc/${process.pid}/fd/1`, "w"); | |
await stdout.write(new TextEncoder().encode(`${process.pid}`)); | |
await stdout.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment