gpii-windows
Version:
Components of the GPII personalization infrastructure for use on Microsoft's "Windows" ™
43 lines (37 loc) • 1.18 kB
JavaScript
/**
* GPII Process Reporter Bridge (Linux -- GLiBTop).
*
* Copyright 2016-2017 OCAD University
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* You may obtain a copy of the License at
* https://github.com/gpii/universal/LICENSE.txt
*/
;
var fluid = require("gpii-universal");
var gpii = fluid.registerNamespace("gpii");
require("./processesBridge.js");
var processesBridge = gpii.processes.windows();
fluid.registerNamespace("gpii.processReporter");
fluid.defaults("gpii.processReporter.find", {
gradeNames: "fluid.function",
argumentMap: {
command: 0
}
});
// Search for the process using its command name. Returns a boolean indicating
// if the process is running (and if the setting is set).
gpii.processReporter.find = function (commandName) {
var running = false;
var theProcess = null;
var procInfos = processesBridge.findSolutionsByCommands([commandName]);
if (procInfos.length > 0) {
theProcess = procInfos[0];
}
if (theProcess !== null) {
running = processesBridge.isRunning(theProcess.state);
}
return running;
};