Skip to content

Instantly share code, notes, and snippets.

@guest271314
Created October 14, 2023 21:34
Show Gist options
  • Save guest271314/e7035fb6717093af965b057a6888031b to your computer and use it in GitHub Desktop.
Save guest271314/e7035fb6717093af965b057a6888031b to your computer and use it in GitHub Desktop.
[Node.js] Write to stdout of current process pid
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