So basically I am making a process class so I can spawn custom processes with ease later on. I want to access the process
object of the child process however I cannot do that for some reason. My code:
let cp = require("child_process")
class Process {
constructor(path, args) {
this.spawnedProcess = cp.fork(path, args)
}
getMemoryUsage() {
return this.spawnedProcess.memoryUsage() //errors here
}
}
TypeError: this.spawnedProcess.memoryUsage is not a function
How can i access the process object of a forked child process?
EDIT:
I have also tried the following
this.spawnedProcess.process.memoryUsage()
(errors with saying process is undefined)