process.title


process.title 属性返回当前进程标题(即返回 ps 的当前值)。 为 process.title 分配一个新值会修改 ps 的当前值。

分配新值时,不同平台会对标题施加不同的最大长度限制。 通常这种限制是相当有限的。

Node.js v0.8 通过覆盖 environ 内存允许更长的进程标题字符串,但这在某些(相当模糊的)情况下可能不安全和混乱。

将值分配给 process.title 可能不会在进程管理器应用程序(例如 macOS 活动监视器或 Windows 服务管理器)中产生准确的标签。

The process.title property returns the current process title (i.e. returns the current value of ps). Assigning a new value to process.title modifies the current value of ps.

When a new value is assigned, different platforms will impose different maximum length restrictions on the title. Usually such restrictions are quite limited. For instance, on Linux and macOS, process.title is limited to the size of the binary name plus the length of the command line arguments because setting the process.title overwrites the argv memory of the process. Node.js v0.8 allowed for longer process title strings by also overwriting the environ memory but that was potentially insecure and confusing in some (rather obscure) cases.

Assigning a value to process.title might not result in an accurate label within process manager applications such as macOS Activity Monitor or Windows Services Manager.