diff options
author | Michael Hutchinson <mhutchinson@novell.com> | 2010-11-13 00:59:54 +0300 |
---|---|---|
committer | Michael Hutchinson <mhutchinson@novell.com> | 2010-11-13 00:59:54 +0300 |
commit | 5122bad572313ae948a42e98ab09a9d80004b788 (patch) | |
tree | 6ba1db6ad4ec88a0cf8dff65f4654a418531cb6a /main/src/addins/Deployment | |
parent | e08ef8d3f465e29abe87b36ec2065acdd896f49f (diff) |
Fix sshfs deploy handler on Mac
Diffstat (limited to 'main/src/addins/Deployment')
2 files changed, 28 insertions, 9 deletions
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs index 846f962e56..009cb2e770 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DialogFileReplacePolicy.cs @@ -59,7 +59,8 @@ namespace MonoDevelop.Deployment.Gui //IFileReplacePolicy is not likely to be running in the GUI thread //so use some DispatchService magic to synchronously call the dialog in the GUI thread DispatchService.GuiSyncDispatch (delegate { - response = (FileReplaceDialog.ReplaceResponse) MessageService.ShowCustomDialog (new FileReplaceDialog (response, source, sourceModified.ToString (), target, targetModified.ToString ())); + var dialog = new FileReplaceDialog (response, source, sourceModified.ToString (), target, targetModified.ToString ()); + response = (FileReplaceDialog.ReplaceResponse) MessageService.ShowCustomDialog (dialog); }); switch (response) { diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/BaseFuseFileCopyHandler.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/BaseFuseFileCopyHandler.cs index 6eceaf6fc5..93e054173e 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/BaseFuseFileCopyHandler.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/BaseFuseFileCopyHandler.cs @@ -64,10 +64,21 @@ namespace MonoDevelop.Deployment.Targets try { base.InternalCopyFiles (monitor, replacePolicy, copyConfig, deployFiles, context, tempDir.FullName); } finally { + //unmount the filesystem try { - //unmount the fuse directory - RunFuseCommand ("fusermount", string.Format ("-u \"{0}\"", tempDir.FullName)); + string escapedDir = tempDir.FullName.Replace ("\"", "\\\""); + string cmd, args; + + if (PropertyService.IsMac) { + cmd = "umount"; + args = string.Format ("\"{0}\"", escapedDir); + } else { + cmd = "fusermount"; + args = string.Format ("-u \"{0}\"", escapedDir); + } + RunFuseCommand (cmd, args); } catch (Exception e) { + LoggingService.LogError (GettextCatalog.GetString ("Could not unmount FUSE filesystem."), e); monitor.ReportError (GettextCatalog.GetString ("Could not unmount FUSE filesystem."), e); } RemoveTempDirIfEmpty (tempDir); @@ -83,13 +94,20 @@ namespace MonoDevelop.Deployment.Targets public abstract void MountTempDirectory (FileCopyConfiguration copyConfig, string tempPath); - protected void RunFuseCommand (string name, string args) + protected void RunFuseCommand (string command, string args) { - MonoDevelop.Core.Execution.ProcessWrapper pWrapper = MonoDevelop.Core.Runtime.ProcessService.StartProcess (name, args, null, null); - pWrapper.WaitForExit (); - if (pWrapper.ExitCode != 0) { - LoggingService.LogWarning ("Failed to run {0} {1}", name, args); - throw new Exception (pWrapper.StandardError.ReadToEnd ()); + LoggingService.LogInfo ("Running FUSE command: {0} {1}", command, args); + var log = new StringWriter (); + var psi = new System.Diagnostics.ProcessStartInfo (command, args) { + RedirectStandardError = true, + RedirectStandardOutput = true, + UseShellExecute = false, + }; + using (var pWrapper = MonoDevelop.Core.Runtime.ProcessService.StartProcess (psi, log, log, null)) { + pWrapper.WaitForOutput (); + System.Console.WriteLine (log.ToString ()); + if (pWrapper.ExitCode != 0) + throw new Exception (log.ToString ()); } } |