Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const performOperation = function (callback)
{
const virtualbox = require("virtualbox");
Logger.log("Restarting VM " + VirtualBoxManager.vmName);
virtualbox.poweroff(VirtualBoxManager.vmName, function (error)
{
if (error)
{
Logger.log("error", "Virtual Machine " + VirtualBoxManager.vmName + "failed to stop");
Logger.log("error", error);
callback(error);
}
else
{
Logger.log("Virtual Machine " + VirtualBoxManager.vmName + "has stopped");
virtualbox.start(VirtualBoxManager.vmName, function (error)
{
if (!isNull(error))
{
Logger.log("error", "Virtual Machine " + VirtualBoxManager.vmName + " failed to stop");
Logger.log("error", error);