subprocess.pid


新增于: v0.1.90

返回子进程的进程标识符 (PID)。如果子进程由于错误而未能生成,则值为 undefined 并触发 error

\Returns the process identifier (PID) of the child process. If the child process fails to spawn due to errors, then the value is undefined and error is emitted.

const { spawn } = require('node:child_process');
const grep = spawn('grep', ['ssh']);
console.log(`Spawned child pid: ${grep.pid}`);
grep.stdin.end();import { spawn } from 'node:child_process';
const grep = spawn('grep', ['ssh']);
console.log(`Spawned child pid: ${grep.pid}`);
grep.stdin.end();

AltStyle によって変換されたページ (->オリジナル) /