~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/addins/MacPlatform/ExternalConsoleProcess.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
// THE SOFTWARE.
26
26
 
27
27
using System;
28
 
using MonoDevelop.Core.Execution;
29
28
using System.Diagnostics;
30
 
using OSXIntegration.Framework;
31
29
using System.Text;
32
 
using MonoDevelop.Core;
33
30
using System.Threading;
34
31
using System.Collections.Generic;
35
32
 
 
33
using MonoDevelop.Core;
 
34
using MonoDevelop.Core.Execution;
 
35
using MonoDevelop.MacInterop;
 
36
 
36
37
namespace MonoDevelop.Platform.Mac
37
38
{
38
 
        public class ExternalConsoleProcess : IProcessAsyncOperation
 
39
        internal class ExternalConsoleProcess : IProcessAsyncOperation
39
40
        {
40
41
/*
41
42
NOTES ON CONTROLLING A TERMINAL WITH APPLESCRIPT         
78
79
bash pause on exit trick
79
80
*/ 
80
81
                string tabId, windowId;
81
 
                bool pauseWhenFinished, cancelled;
 
82
                bool cancelled;
82
83
                
83
84
                public ExternalConsoleProcess (string command, string arguments, string workingDirectory,
84
85
                                               IDictionary<string, string> environmentVariables,
85
86
                                               string title, bool pauseWhenFinished)
86
87
                {
87
 
                        this.pauseWhenFinished = pauseWhenFinished;
88
 
                        
89
88
                        //build the sh command
90
 
                        var sb = new StringBuilder ();
 
89
                        var sb = new StringBuilder ("clear; ");
91
90
                        if (!string.IsNullOrEmpty (workingDirectory))
92
91
                                sb.AppendFormat ("cd \"{0}\"; ", Escape (workingDirectory));
93
92
                        foreach (string env in environmentVariables.Keys)
162
161
                public void Cancel ()
163
162
                {
164
163
                        cancelled = true;
 
164
                        //FIXME: try to kill the process without closing the window, if pauseWhenFinished is true
165
165
                        CloseTerminalWindow ();
166
166
                }
167
167
                
172
172
                        }
173
173
                }
174
174
                
175
 
                
176
175
                public bool IsCompleted {
177
176
                        get {
 
177
                                //FIXME: get the status of the process, not the whole script
178
178
                                var ret = AppleScript.Run ("tell app \"Terminal\" to get exists of {0} of {1}", tabId, windowId);
179
179
                                return ret != "true";
180
180
                        }