Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez Gual <lluis@novell.com>2011-02-09 13:10:58 +0300
committerLluis Sanchez Gual <lluis@novell.com>2011-02-09 13:10:58 +0300
commitddae19b75436455641d9ec9e50278c0f70c0a90e (patch)
tree6d212833b3332bf4ce51151d517d76371b4af574
parentf928f17f482f663ca557afada7387cfd0481653a (diff)
Custom command fixes
Improved error message when a custom command fails. Quote the command path when selecting a path which has spaces on it.
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CustomCommand.cs44
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs2
2 files changed, 26 insertions, 20 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CustomCommand.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CustomCommand.cs
index 68082d509c..d6ea8b724c 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CustomCommand.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CustomCommand.cs
@@ -190,28 +190,32 @@ namespace MonoDevelop.Projects
IProcessAsyncOperation oper;
- if (context != null) {
- IConsole console;
- if (externalConsole)
- console = context.ExternalConsoleFactory.CreateConsole (!pauseExternalConsole);
- else
- console = context.ConsoleFactory.CreateConsole (!pauseExternalConsole);
-
- ExecutionCommand cmd = Runtime.ProcessService.CreateCommand (exe);
- ProcessExecutionCommand pcmd = cmd as ProcessExecutionCommand;
- if (pcmd != null) {
- pcmd.Arguments = args;
- pcmd.WorkingDirectory = dir;
+ try {
+ if (context != null) {
+ IConsole console;
+ if (externalConsole)
+ console = context.ExternalConsoleFactory.CreateConsole (!pauseExternalConsole);
+ else
+ console = context.ConsoleFactory.CreateConsole (!pauseExternalConsole);
+
+ ExecutionCommand cmd = Runtime.ProcessService.CreateCommand (exe);
+ ProcessExecutionCommand pcmd = cmd as ProcessExecutionCommand;
+ if (pcmd != null) {
+ pcmd.Arguments = args;
+ pcmd.WorkingDirectory = dir;
+ }
+ oper = context.ExecutionHandler.Execute (cmd, console);
}
- oper = context.ExecutionHandler.Execute (cmd, console);
- }
- else {
- if (externalConsole) {
- IConsole console = ExternalConsoleFactory.Instance.CreateConsole (!pauseExternalConsole);
- oper = Runtime.ProcessService.StartConsoleProcess (exe, args, dir, console, null);
- } else {
- oper = Runtime.ProcessService.StartProcess (exe, args, dir, monitor.Log, monitor.Log, null, false);
+ else {
+ if (externalConsole) {
+ IConsole console = ExternalConsoleFactory.Instance.CreateConsole (!pauseExternalConsole);
+ oper = Runtime.ProcessService.StartConsoleProcess (exe, args, dir, console, null);
+ } else {
+ oper = Runtime.ProcessService.StartProcess (exe, args, dir, monitor.Log, monitor.Log, null, false);
+ }
}
+ } catch (Exception ex) {
+ throw new UserException (GettextCatalog.GetString ("Command execution failed: {0}",ex.Message));
}
monitor.CancelRequested += delegate {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs
index d760cd356d..e78d025a65 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs
@@ -111,6 +111,8 @@ namespace MonoDevelop.Ide.Projects.OptionPanels
entryCommand.Text = FileService.AbsoluteToRelativePath (entry.BaseDirectory, dlg.SelectedFile);
else
entryCommand.Text = dlg.SelectedFile;
+ if (entryCommand.Text.IndexOf (' ') != -1)
+ entryCommand.Text = '"' + entryCommand.Text + '"';
}
protected virtual void OnEntryCommandChanged(object sender, System.EventArgs e)