Ejemplo n.º 1
0
 private void AddCommandToCleanupList(Command cmd)
 {
     lock (s_commandsToCleanup)
     {
         foreach (WeakReference cmdElemRef in s_commandsToCleanup)
         {
             var cmdElem = cmdElemRef.Target as Command;
             if (cmdElem == null || cmdElem.HasExited)
             {
                 cmdElemRef.Target = cmd;
                 return;
             }
         }
         s_commandsToCleanup.Add(new WeakReference(cmd));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Run 'commandLine' as a subprocess and waits for the command to complete.
 /// Output is captured and placed in the 'Output' property of the returned Command 
 /// structure. 
 /// </summary>
 /// <param variable="commandLine">The command lineNumber to run as a subprocess</param>
 /// <param variable="options">Additional qualifiers that control how the process is run</param>
 /// <returns>A Command structure that can be queried to determine ExitCode, Output, etc.</returns>
 public static Command Run(string commandLine, CommandOptions options)
 {
     Command run = new Command(commandLine, options);
     run.Wait();
     return run;
 }