private void GulpCallback(object sender, EventArgs e) { var cmd = (OleMenuCommand)sender; var text = cmd.Text; var task = text.Substring(text.IndexOf(':') + 1).Trim(); if (task == "Gulp") { task = ""; } // if the command is checked it means that there is a running grunt task associated // so we kill it if (cmd.Checked) { System.Diagnostics.Process pro; processes.TryGetValue(cmd, out pro); if (pro != null) { OutputHelpers.Output("Stopping process " + cmd.Text); ProcessHelpers.KillProcessAndChildren(pro.Id); processes.Remove(cmd); } } if (!cmd.Checked) { // launches the grunt process and redirects the output to the output window RunProcess(cmd, " /c \"gulp --no-color " + task + " 2>&1 \" ", false); } else { cmd.Checked = false; } }
private void OnOnBuildBegin(vsBuildScope scope, vsBuildAction action) { if (!Options.StopProcessesOnBuild) { return; } foreach (var process in processes) { ProcessHelpers.KillProcessAndChildren(process.Value.Id); } processes = new Dictionary <OleMenuCommand, System.Diagnostics.Process>(); }