Skip to content

How to avoid echo to native Terminal? #170

@vorburger

Description

@vorburger

With the following code, using this StreamPumper from here:

String[] cmd = {"/bin/sh", "-l"};
Map<String, String> env = new HashMap<>(System.getenv());
if (!env.containsKey("TERM")) env.put("TERM", "xterm-256color");
PtyProcess process = new PtyProcessBuilder().setCommand(cmd).setEnvironment(env).start();

OutputStream os = process.getOutputStream();
new StreamPumper("In", System.in, os);

InputStream is = process.getInputStream();
new StreamPumper("Out", is, System.out);

return process.waitFor();

I'm getting an "echo" that I (conceptually) don't quite understand how to get rid of when using Pty4j:

[main] INFO com.pty4j.util.ExtractedNative - Extracted pty4j native in 8 ms
...$ ls
ls
...

I could put a fully running standalone reproducer project e.g. on https://github.com/vorburger/LearningPty4J, if there is interest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions