Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- - Create index.js with contents below
- - npm install --save edge
- - launch notepad.exe
- - run node index.js
- output:
- [ben@oc2077774057 processtest]$ cat output.txt
- c:\vagrant\processtest>node index.js
- { HasExited: false,
- Id: 4052,
- Threads:
- [ { BasePriority: 8,
- CurrentPriority: 10,
- Id: 4392,
- PriorityBoostEnabled: true,
- PriorityLevel: 'Normal',
- PrivilegedProcessorTime: [Object],
- StartAddress: '140732887113520',
- StartTime: Wed Jul 20 2016 13:15:24 GMT-0700 (Pacific Daylight Time),
- ThreadState: 'Wait',
- TotalProcessorTime: [Object],
- UserProcessorTime: [Object],
- WaitReason: 'UserRequest',
- Site: null,
- Container: null },
- { BasePriority: 8,
- CurrentPriority: 8,
- Id: 3204,
- PriorityBoostEnabled: true,
- PriorityLevel: 'Normal',
- PrivilegedProcessorTime: [Object],
- StartAddress: '140732887113520',
- StartTime: Wed Jul 20 2016 13:35:55 GMT-0700 (Pacific Daylight Time),
- ThreadState: 'Wait',
- TotalProcessorTime: [Object],
- UserProcessorTime: [Object],
- WaitReason: 'EventPairLow',
- Site: null,
- Container: null } ],
- ProcessName: 'notepad',
- StartInfo:
- { Verb: '',
- Arguments: '',
- CreateNoWindow: false,
- EnvironmentVariables:
- [ [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object] ],
- Environment:
- [ [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object],
- [Object] ],
- RedirectStandardInput: false,
- RedirectStandardOutput: false,
- RedirectStandardError: false,
- StandardErrorEncoding: null,
- StandardOutputEncoding: null,
- UseShellExecute: true,
- Verbs: [],
- UserName: '',
- Password: null,
- PasswordInClearText: null,
- Domain: '',
- LoadUserProfile: false,
- FileName: '',
- WorkingDirectory: '',
- ErrorDialog: false,
- ErrorDialogParentHandle: '0',
- WindowStyle: 'Normal' },
- StartTime: Wed Jul 20 2016 13:15:24 GMT-0700 (Pacific Daylight Time) }
- */
- /***** index.js: *****/
- var edge = require("edge");
- var get_process_state = edge.func(function () {/*
- using System.Threading.Tasks;
- using System.Diagnostics;
- using System.Dynamic;
- public class Startup
- {
- public async Task<object> Invoke(dynamic input)
- {
- var processName = (string)input;
- var process = Process.GetProcessesByName(processName)[0];
- var pInfo = new {
- HasExited = process.HasExited,
- Id = process.Id,
- Threads = process.Threads,
- ProcessName = process.ProcessName,
- StartInfo = process.StartInfo,
- StartTime = process.StartTime
- };
- return pInfo;
- }
- }
- */});
- var myProcess = get_process_state("notepad", true);
- console.log(myProcess);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement