process.title
- 类型:<string>
process.title 属性返回当前进程标题(即返回 ps 的当前值)。给 process.title 赋一个新值会修改 ps 的当前值。
【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.】
当分配了一个新值时,不同的平台会对标题施加不同的最大长度限制。通常这些限制相当有限。例如,在 Linux 和 macOS 上,process.title 的长度限制是二进制文件名的大小加上命令行参数的长度,因为设置 process.title 会覆盖进程的 argv 内存。Node.js v0.8 通过同时覆盖 environ 内存,允许更长的进程标题字符串,但在某些(相当罕见的)情况下,这可能存在安全隐患并产生混淆。
【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.】
将值分配给 process.title 可能不会在 macOS 活动监视器或 Windows 服务管理器等进程管理应用中显示准确的标签。
【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.】