• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PtyProcess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.pty4j.PtyProcess的典型用法代码示例。如果您正苦于以下问题:Java PtyProcess类的具体用法?Java PtyProcess怎么用?Java PtyProcess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PtyProcess类属于com.pty4j包,在下文中一共展示了PtyProcess类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: connect

import com.pty4j.PtyProcess; //导入依赖的package包/类
public void connect() throws IOException {
    if (localTerminalPanel == null) {
        throw new IllegalStateException("local terminal panel is not set");
    }
    if (pty != null && pty.isAlive()) {
        return;
    }

    String[] cmd = {"/bin/bash", "-i"};
    Map<String, String> envs = new HashMap<>(System.getenv());
    envs.remove("TERM_PROGRAM"); // for OS X
    envs.put("TERM", "vt102");

    pty = PtyProcess.exec(cmd, envs, System.getProperty("user.home"));

    OutputStream os = pty.getOutputStream();
    InputStream is = pty.getInputStream();

    PrintStream printStream = new PrintStream(os, true);
    localTerminalPanel.setPrintStream(printStream);

    Runnable run = new TerminalWatcher(is, localTerminalPanel.getTextArea());
    thread = new Thread(run);
    thread.start();
}
 
开发者ID:malafeev,项目名称:JFTClient,代码行数:26,代码来源:LocalTerminal.java


示例2: createTtyConnector

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
public TtyConnector createTtyConnector() {
  try {
    Map<String, String> envs = Maps.newHashMap(System.getenv());
    String[] command;

    if (UIUtil.isWindows) {
      command = new String[]{"cmd.exe"};
    } else {
      command = new String[]{"/bin/bash", "--login"};
      envs.put("TERM", "xterm");
    }

    PtyProcess process = PtyProcess.exec(command, envs, null);

    return new LoggingPtyProcessTtyConnector(process, Charset.forName("UTF-8"));
  } catch (Exception e) {
    throw new IllegalStateException(e);
  }
}
 
开发者ID:JetBrains,项目名称:jediterm,代码行数:21,代码来源:PtyMain.java


示例3: initializeProcess

import com.pty4j.PtyProcess; //导入依赖的package包/类
private void initializeProcess() throws Exception {

        String userHome = System.getProperty("user.home");
        Path dataDir = Paths.get(userHome).resolve(".terminalfx");
        IOHelper.copyLibPty(dataDir);

        if (Platform.isWindows()) {
            this.termCommand = "cmd.exe".split("\\s+");
        } else {
            this.termCommand = "/bin/bash -i".split("\\s+");
        }

        if(Objects.nonNull(shellStarter)){
            this.termCommand = shellStarter.split("\\s+");
        }

        Map<String, String> envs = new HashMap<>(System.getenv());
        envs.put("TERM", "xterm");

        System.setProperty("PTY_LIB_FOLDER", dataDir.resolve("libpty").toString());

        this.process = PtyProcess.exec(termCommand, envs, userHome);

        process.setWinSize(new WinSize(columns, rows));
        this.inputReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
        this.errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
        this.outputWriter = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));

        ThreadHelper.start(() -> {
            printReader(inputReader);
        });

        ThreadHelper.start(() -> {
            printReader(errorReader);
        });

        process.waitFor();

    }
 
开发者ID:javaterminal,项目名称:cloudterm,代码行数:40,代码来源:TerminalService.java


示例4: ProcessTtyConnector

import com.pty4j.PtyProcess; //导入依赖的package包/类
public ProcessTtyConnector(PtyProcess process, Charset charset) {
    this.process = process;
    this.charset = charset;
    this.inputStream = process.getInputStream();
    this.outputStream = process.getOutputStream();
    this.reader = new InputStreamReader(inputStream, charset);
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:8,代码来源:ProcessTtyConnector.java


示例5: TerminalEmulator

import com.pty4j.PtyProcess; //导入依赖的package包/类
public TerminalEmulator(String termId, SocketIOSessionOutbound outbound, String[]command, Map<String, String> envs, String workingDirectory) throws IOException {
    PtyProcess pty = PtyProcess.exec(command, envs, workingDirectory);// working dir

    this.termId = termId;
    this.outbound = outbound;
    this.ttyConnector = new ProcessTtyConnector(pty, charset);
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:8,代码来源:TerminalEmulator.java


示例6: startProcessWithPty

import com.pty4j.PtyProcess; //导入依赖的package包/类
@NotNull
public Process startProcessWithPty(@NotNull List<String> commands, boolean console) throws IOException {
  Map<String, String> env = new HashMap<String, String>();
  setupEnvironment(env);

  if (isRedirectErrorStream()) {
    LOG.error("Launching process with PTY and redirected error stream is unsupported yet");
  }

  File workDirectory = getWorkDirectory();
  boolean cygwin = myUseCygwinLaunch && SystemInfo.isWindows;
  return PtyProcess.exec(ArrayUtil.toStringArray(commands), env, workDirectory != null ? workDirectory.getPath() : null, console, cygwin,
                         ApplicationManager.getApplication().isEAP() ? getPtyLogFile() : null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PtyCommandLine.java


示例7: createProcess

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected PtyProcess createProcess(@Nullable String directory) throws ExecutionException {
  Map<String, String> envs = new HashMap<String, String>(System.getenv());
  envs.put("TERM", "xterm-256color");
  EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(envs, myDefaultCharset);
  try {
    return PtyProcess.exec(getCommand(), envs, directory != null ? directory : currentProjectFolder());
  }
  catch (IOException e) {
    throw new ExecutionException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:LocalTerminalDirectRunner.java


示例8: createProcess

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected PtyProcess createProcess() throws ExecutionException {
  Map<String, String> envs = new HashMap<String, String>(System.getenv());
  envs.put("TERM", "xterm");
  try {
    return PtyProcess.exec(myCommand, envs, null);
  }
  catch (IOException e) {
    throw new ExecutionException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:LocalTerminalDirectRunner.java


示例9: createProcess

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected PtyProcess createProcess(@Nullable String directory) throws ExecutionException
{
	Map<String, String> envs = new HashMap<String, String>(System.getenv());
	envs.put("TERM", "xterm-256color");
	//EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(envs, myDefaultCharset);
	try
	{
		return PtyProcess.exec(getCommand(), envs, directory != null ? directory : currentProjectFolder());
	}
	catch(IOException e)
	{
		throw new ExecutionException(e);
	}
}
 
开发者ID:consulo,项目名称:consulo-terminal,代码行数:16,代码来源:LocalTerminalDirectRunner.java


示例10: startProcessWithPty

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Nonnull
public Process startProcessWithPty(@Nonnull List<String> commands, boolean console) throws IOException {
  Map<String, String> env = new HashMap<>();
  setupEnvironment(env);

  if (isRedirectErrorStream()) {
    LOG.error("Launching process with PTY and redirected error stream is unsupported yet");
  }

  String[] command = ArrayUtil.toStringArray(commands);
  File workDirectory = getWorkDirectory();
  String directory = workDirectory != null ? workDirectory.getPath() : null;
  boolean cygwin = myUseCygwinLaunch && SystemInfo.isWindows;
  return PtyProcess.exec(command, env, directory, console, cygwin, getPtyLogFile());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:PtyCommandLine.java


示例11: RocTtyConnector

import com.pty4j.PtyProcess; //导入依赖的package包/类
RocTtyConnector(PtyProcess process, Charset charset)
{
    super(process, charset);
    this.myProcess = process;
}
 
开发者ID:whitefire,项目名称:roc-completion,代码行数:6,代码来源:RocTtyConnector.java


示例12: createTtyConnector

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected TtyConnector createTtyConnector(PtyProcess process)
{
    return new RocTtyConnector(process, CharsetToolkit.UTF8_CHARSET);
}
 
开发者ID:whitefire,项目名称:roc-completion,代码行数:6,代码来源:RocTerminal.java


示例13: createProcessHandler

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected ProcessHandler createProcessHandler(final PtyProcess process) {
  return new PtyProcessHandler(process);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LocalTerminalDirectRunner.java


示例14: createTtyConnector

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected TtyConnector createTtyConnector(PtyProcess process) {
  return new PtyProcessTtyConnector(process, myDefaultCharset);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LocalTerminalDirectRunner.java


示例15: getTerminalConnectionName

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected String getTerminalConnectionName(PtyProcess process) {
  return "Local Terminal";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LocalTerminalDirectRunner.java


示例16: PtyProcessHandler

import com.pty4j.PtyProcess; //导入依赖的package包/类
public PtyProcessHandler(PtyProcess process) {
  myProcess = process;
  myWaitFor = new ProcessWaitFor(process, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LocalTerminalDirectRunner.java


示例17: getTerminalConnectionName

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected String getTerminalConnectionName(PtyProcess process) {
  return StringUtil.join(myCommand);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:LocalTerminalDirectRunner.java


示例18: createProcessHandler

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected ProcessHandler createProcessHandler(final PtyProcess process)
{
	return new PtyProcessHandler(process);
}
 
开发者ID:consulo,项目名称:consulo-terminal,代码行数:6,代码来源:LocalTerminalDirectRunner.java


示例19: createTtyConnector

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected TtyConnector createTtyConnector(PtyProcess process)
{
	return new PtyProcessTtyConnector(process, myDefaultCharset);
}
 
开发者ID:consulo,项目名称:consulo-terminal,代码行数:6,代码来源:LocalTerminalDirectRunner.java


示例20: getTerminalConnectionName

import com.pty4j.PtyProcess; //导入依赖的package包/类
@Override
protected String getTerminalConnectionName(PtyProcess process)
{
	return "Local Terminal";
}
 
开发者ID:consulo,项目名称:consulo-terminal,代码行数:6,代码来源:LocalTerminalDirectRunner.java



注:本文中的com.pty4j.PtyProcess类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TransactionManager类代码示例发布时间:2022-05-22
下一篇:
Java TwoColumnCssLayout类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap