private void RunVagrantAction(string action, VagrantInstance instance)
        {
            string command;

            if (action == "up")
            {
                command = String.Format("vagrant up{0}", !String.IsNullOrEmpty(instance.ProviderIdentifier) ? String.Format(" --provider={0}", instance.ProviderIdentifier) : "virtualbox");
            }
            else if (action == "reload")
            {
                command = "vagrant reload";
            }
            else if (action == "suspend")
            {
                command = "vagrant suspend";
            }
            else if (action == "halt")
            {
                command = "vagrant halt";
            }
            else if (action == "provision")
            {
                command = "vagrant provision";
            }
            else if (action == "destroy")
            {
                command = "vagrant destroy -f";
            }
            else if (action == "rsync")
            {
                command = "vagrant rsync";
            }
            else
            {
                return;
            }

            Process process = new Process();

            process.StartInfo.FileName               = "cmd";
            process.StartInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.Arguments              = String.Format("/C cd /d {0} && {1}", Util.EscapeShellArg(instance.Path), command);

            TaskOutputWindow outputWindow = new TaskOutputWindow
            {
                Task        = process,
                TaskCommand = process.StartInfo.Arguments,
                TaskAction  = command,
                Target      = instance
            };

            outputWindow.Show();
        }
Exemple #2
0
 private void RemoveTaskOutputWindow(TaskOutputWindow taskOutputWindow)
 {
     _TaskOutputWindows.Remove(taskOutputWindow);
 }