コード例 #1
0
ファイル: FilterText.cs プロジェクト: zweib730/beagrep
 static string getLangMap() {
         SafeProcess langmapPc = new SafeProcess();
         string[] args = new string[1];
         args[0] = "lang-map-for-ctags";
         langmapPc.Arguments = args;
         langmapPc.Start();
         return new StreamReader(langmapPc.StandardOutput).ReadToEnd();
 }
コード例 #2
0
ファイル: FilterText.cs プロジェクト: zweib730/beagrep
                static FilterText() {
                        if (Environment.GetEnvironmentVariable("SOURCECODETAGSMODE") == "true") {
                                sourceCodeTagsMode = true;
                                ctagsPc = new SafeProcess ();

                                string[] args = new string[7];

                                args[0] = "ctags-ajoke";
                                args[1] = "--langmap=" + getLangMap();
                                args[2] = "-xu";
                                args[3] = "--filter";
                                args[4] = "--filter-terminator=###terminator###\n";
                                args[5] = "--extra=+q";
                                args[6] = "--c-kinds=+p";
                                ctagsPc.Arguments = args;
                                ctagsPc.RedirectStandardOutput = true;
                                ctagsPc.RedirectStandardInput = true;
                                ctagsPc.Start();
                                ctagsInput = new StreamWriter(ctagsPc.StandardInput);
                                ctagsOutput = new StreamReader(ctagsPc.StandardOutput);
                        }
                }
コード例 #3
0
ファイル: RemoteIndexer.cs プロジェクト: zweib730/beagrep
		static void LaunchHelper ()
		{
			// If we are in the process of shutting down, return immediately.
			if (Shutdown.ShutdownRequested)
				return;

			lock (helper_lock) {

				// If a helper appears to be running, return immediately.
				if (CheckHelper ())
					return;
				
				Logger.Log.Debug ("Launching helper process");

				SafeProcess p = new SafeProcess ();
				string[] args = new string [3];
				args [0] = helper_path;

				if (BeagrepDaemon.DisableTextCache)
					args [1] = "--disable-text-cache";
				else
					args [1] = String.Empty;

				if (Log.Level == LogLevel.Debug)
					args [2] = "--debug";
				else
					args [2] = String.Empty;

				p.Arguments = args;
				p.RedirectStandardOutput = false;
				p.RedirectStandardError = false;
				p.Start ();

				Logger.Log.Debug ("IndexHelper PID is {0}", p.Id);

				// Poll the helper's socket.  Wait up to a minute
				// (500 ms * 120 times) for the helper to be ready
				// to handle requests.
				Stopwatch watch = new Stopwatch ();
				watch.Start ();
				int poll_count = 0;
				bool found_helper;
				do {
					Thread.Sleep (500);
					++poll_count;
					found_helper = CheckHelper ();
				} while (poll_count < 120 
					 && ! found_helper
					 && ! Shutdown.ShutdownRequested);
				watch.Stop ();
				
				if (! found_helper)
					throw new Exception (String.Format ("Couldn't launch helper process {0}", p.Id));

				Logger.Log.Debug ("Found IndexHelper ({0}) in {1}", p.Id, watch);
				helper_pid = p.Id;
			}
		}