How to use the virtualbox.poweroff function in virtualbox

To help you get started, we’ve selected a few virtualbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github feup-infolab / dendro / src / utils / virtualbox / vm_manager.js View on Github external
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);