mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-19 01:33:18 +00:00
Improved agent that can update the MeshCentral1 agent
This commit is contained in:
27
Debug/ChildProcessTest.js
Normal file
27
Debug/ChildProcessTest.js
Normal file
@@ -0,0 +1,27 @@
|
||||
var child = require('child_process');
|
||||
var childProcess = null;
|
||||
|
||||
if (process.platform == 'win32')
|
||||
{
|
||||
childProcess = child.execFile(process.env['windir'] + '\\system32\\cmd.exe', ['/c', 'dir'], OnChild);
|
||||
}
|
||||
else if (process.platform == 'linux')
|
||||
{
|
||||
childProcess = child.execFile('/bin/sh', ['sh', '-c', 'ls'], OnChild);
|
||||
}
|
||||
|
||||
if (childProcess != null)
|
||||
{
|
||||
console.log('PID = ' + childProcess.pid);
|
||||
childProcess.stdout.on('data', function (chunk) { console.log(chunk.toString()); });
|
||||
childProcess.on('exit', function (code, sig) { console.log("Process Exited with code: " + code.toString()); });
|
||||
}
|
||||
//for (var envkey in process.env)
|
||||
//{
|
||||
// console.log("Environment Variable: [" + envkey + "] = " + process.env[envkey]);
|
||||
//}
|
||||
|
||||
function OnChild(err, stdErr, stdOut)
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user