-
Notifications
You must be signed in to change notification settings - Fork 210
Get input data on output listener method #184
Copy link
Copy link
Open
Description
I am using pty.js in a nodejs application to emulate a interactive terminal. But the I got the input data in the output listener method. Is there a way to get the output data only?
Below is my source code:
var pty = require('pty.js');
var term = pty.spawn('bash', [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: process.env.HOME,
env: process.env
});
term.on('data', function(data) {
console.log(data);
});
term.write('echo hello\n');
when running above code, I can see the output:
$ node official.js
echo hello
bash-3.2$ echo hello
hello
bash-3.2$
from the above output you can observe that the input command echo hello got printed twice in term.on('data' ...) function. Is there a way to get ride of the input data from the output listener method?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels