Exemple #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute() throws org.apache.tools.ant.BuildException
        public virtual void execute()
        {
            if (dir == null)
            {
                throw new BuildException("dir attribute is required with the launch task");
            }
            if (string.ReferenceEquals(script, null))
            {
                throw new BuildException("script attribute is required with the launch task");
            }

            string[] cmd        = null;
            string   executable = Executable;

            if (!string.ReferenceEquals(args, null))
            {
                IList <string> pieces = new List <string>();
                pieces.Add(executable);
                StringTokenizer tokenizer = new StringTokenizer("args", " ");
                while (tokenizer.hasMoreTokens())
                {
                    pieces.Add(tokenizer.nextToken());
                }
                cmd = pieces.ToArray();
            }
            else
            {
                cmd = new string[] { executable };
            }

            LaunchThread.launch(this, cmd, dir, msg);
        }
Exemple #2
0
 public static void launch(Task task, string[] cmd, File dir, string launchCompleteText)
 {
     if (cmd == null)
     {
         throw new BuildException("cmd is null");
     }
     try
     {
         LaunchThread launchThread = new LaunchThread(task, cmd, dir, launchCompleteText);
         launchThread.Start();
         launchThread.Join();
     }
     catch (Exception e)
     {
         throw new BuildException("couldn't launch cmd: " + cmdString(cmd), e);
     }
 }