================ @@ -0,0 +1,102 @@ +import { ChildProcessWithoutNullStreams } from "child_process"; +import { Process, ProcessTree } from "."; +import { Transform } from "stream"; + +/** Parses process information from a given line of process output. */ +export type ProcessTreeParser = (line: string) => Process | undefined; + +/** + * Implements common behavior between the different {@link ProcessTree} implementations. + */ +export abstract class BaseProcessTree implements ProcessTree { + /** + * Spawn the process responsible for collecting all processes on the system. + */ + protected abstract spawnProcess(): ChildProcessWithoutNullStreams; ---------------- ashgti wrote:
It may be easer to use the `exec`/`execFile`. If you use the promise form of the `exec`/`execFile` call you get the output as a single chunk which simplifies processing. You could use something like: ``` const exec = util.promisify(child_process.execFile); // this can go at the top of the file const { stdout } = await exec("ps", [...]); for (const line of stdout.split('\n')) { /* process lines */ } ``` https://github.com/llvm/llvm-project/pull/128943 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits