hudson.model.Hudson.createLauncher()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中hudson.model.Hudson.createLauncher()方法的一些代码示例,展示了Hudson.createLauncher()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hudson.createLauncher()方法的具体详情如下:
包路径:hudson.model.Hudson
类名称:Hudson
方法名:createLauncher

Hudson.createLauncher介绍

暂无

代码示例

代码示例来源:origin: org.jvnet.hudson.plugins/clearcase

public void doListViews(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  Hudson.getInstance().createLauncher(TaskListener.NULL).launch().cmds(getCleartoolExe(), "lsview", "-short").stdout(baos).join();
  rsp.setContentType("text/plain");
  rsp.getOutputStream().println("ClearCase Views found:\n");
  baos.writeTo(rsp.getOutputStream());
}

代码示例来源:origin: org.jvnet.hudson.plugins/perforce

public void exec(String[] cmd) throws PerforceException {
  try {
    // ensure we actually have a valid hudson launcher
    if (null == hudsonLauncher) {
      hudsonLauncher = Hudson.getInstance().createLauncher(new StreamTaskListener(System.out));
    }
    // hudsonOut->p4in->reader
    HudsonPipedOutputStream hudsonOut = new HudsonPipedOutputStream();
    FastPipedInputStream p4in = new FastPipedInputStream(hudsonOut);
    reader = new BufferedReader(new InputStreamReader(p4in));
    // hudsonIn<-p4Out<-writer
    FastPipedInputStream hudsonIn = new FastPipedInputStream();
    FastPipedOutputStream p4out = new FastPipedOutputStream(hudsonIn);
    writer = new BufferedWriter(new OutputStreamWriter(p4out));
    Proc process = hudsonLauncher.launch().cmds(cmd).envs(env).stdin(hudsonIn).stdout(hudsonOut).pwd(filePath).start();
    
    // Required to close hudsonOut stream
    hudsonOut.closeOnProcess(process);
  } catch(IOException e) {
    //try to close all the pipes before throwing an exception
    closeBuffers();
    
    throw new PerforceException("Could not run perforce command.", e);
  }
}

代码示例来源:origin: org.hudsonci.plugins/mercurial

launcher = Hudson.getInstance().createLauncher(listener);
PossiblyCachedRepo possiblyCachedRepo = cachedSource(Hudson.getInstance(), launcher, listener, true);
if (possiblyCachedRepo == null) {

代码示例来源:origin: org.jvnet.hudson.plugins/clearcase

Launcher launcher = hudson.createLauncher(listener);
ClearTool ct = ccScm.createClearTool(null, ccScm.createClearToolLauncher(listener, project.getSomeWorkspace().getParent().getParent(),
    launcher));

代码示例来源:origin: org.hudsonci.plugins/cvs

/**
 * Runs cvs login command.
 * <p/>
 * TODO: this apparently doesn't work. Probably related to the fact that
 * cvs does some tty magic to disable echo back or whatever.
 */
public void doPostPassword(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException {
  Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
  String cvsroot = req.getParameter("cvsroot");
  String password = req.getParameter("password");
  if (cvsroot == null || password == null) {
    rsp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    return;
  }
  rsp.setContentType("text/plain");
  Proc proc = Hudson.getInstance().createLauncher(TaskListener.NULL).launch()
    .cmds(getCvsExeOrDefault(), "-d", cvsroot, "login")
    .stdin(new ByteArrayInputStream((password + "\n").getBytes()))
    .stdout(rsp.getOutputStream()).start();
  proc.join();
}

代码示例来源:origin: org.jvnet.hudson.plugins/cvs

/**
   * Runs cvs login command.
   * <p/>
   * TODO: this apparently doesn't work. Probably related to the fact that
   * cvs does some tty magic to disable echo back or whatever.
   */
  public void doPostPassword(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException {
    Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
    String cvsroot = req.getParameter("cvsroot");
    String password = req.getParameter("password");
    if (cvsroot == null || password == null) {
      rsp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return;
    }
    rsp.setContentType("text/plain");
    Proc proc = Hudson.getInstance().createLauncher(TaskListener.NULL).launch()
      .cmds(getCvsExeOrDefault(), "-d", cvsroot, "login")
      .stdin(new ByteArrayInputStream((password + "\n").getBytes()))
      .stdout(rsp.getOutputStream()).start();
    proc.join();
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/clearcase

/**
 * Displays "cleartool -version" for trouble shooting.
 */
public void doVersion(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException {
  ByteBuffer baos = new ByteBuffer();
  try {
    Hudson.getInstance().createLauncher(TaskListener.NULL).launch().cmds(getCleartoolExe(), "-version").stdout(baos).join();
    rsp.setContentType("text/plain");
    baos.writeTo(rsp.getOutputStream());
  } catch (IOException e) {
    req.setAttribute("error", e);
    rsp.forward(this, "versionCheckError", req);
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/cvs

/**
 * Displays "cvs --version" for trouble shooting.
 */
public void doVersion(StaplerRequest req, StaplerResponse rsp)
  throws IOException, ServletException, InterruptedException {
  ByteBuffer baos = new ByteBuffer();
  try {
    Hudson.getInstance().createLauncher(TaskListener.NULL).launch()
      .cmds(getCvsExeOrDefault(), "--version").stdout(baos).join();
    rsp.setContentType("text/plain");
    baos.writeTo(rsp.getOutputStream());
  } catch (IOException e) {
    req.setAttribute("error", e);
    rsp.forward(this, "versionCheckError", req);
  }
}

代码示例来源:origin: org.hudsonci.plugins/cvs

/**
 * Displays "cvs --version" for trouble shooting.
 */
public void doVersion(StaplerRequest req, StaplerResponse rsp)
  throws IOException, ServletException, InterruptedException {
  ByteBuffer baos = new ByteBuffer();
  try {
    Hudson.getInstance().createLauncher(TaskListener.NULL).launch()
      .cmds(getCvsExeOrDefault(), "--version").stdout(baos).join();
    rsp.setContentType("text/plain");
    baos.writeTo(rsp.getOutputStream());
  } catch (IOException e) {
    req.setAttribute("error", e);
    rsp.forward(this, "versionCheckError", req);
  }
}

代码示例来源:origin: org.jvnet.hudson.plugins/clearcase

Launcher launcher = hudson.createLauncher(listener);

相关文章

Hudson类方法