stderr always coming in stdout
Chưa có ai nhận issue này.
- #342 của @steelbrain — đã đóng, không merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu tại điểm vào ssh.exec với các tùy chọn pty, stdin và stream: 'both' được báo cáo, sau đó theo dõi cách đầu ra của lệnh được gán vào result.stdout và result.stderr. Tái hiện trường hợp sudo apt updat và xác nhận rằng văn bản lỗi được tách vào result.stderr trong khi mã thoát vẫn là 100.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi,
I have faced an issue, which always returns stderr in result.stdout rather than result.stderr.
node-ssh version 10.0.2
ssh.connect({
host: 'localhost',
username: '<username>',
password: '<password>'
}).then(() => {
ssh.exec('sudo apt updat', [], {
execOptions: { pty : true },
stdin: '<password>\n',
stream: 'both'
}).then((result) => {
console.log("Result StdOut", result.stdout)
console.log("Result StdErr", result.stderr)
console.log("Result", result)
})
})
Note: Intensively I make an error in the command sudo apt updat to expecting error.
When I execute above code I got the error always in the stdout.
Result StdOut
[sudo] password for <username>:
E: Invalid operation updat
Result StdErr
Result {
code: 100,
signal: null,
stdout: '<password>\r\n' +
'[sudo] password for <username>: \r\n' +
'\u001b[1;31mE: \u001b[0mInvalid operation updat\u001b[0m',
stderr: ''
}
But the same is working expected using ssh2
Below is the sample.
var Client = require('ssh2').Client;
var conn = new Client();
conn.on('ready', function() {
console.log('Client :: ready');
conn.exec('apt updat', function(err, stream) {
if (err) throw err;
stream.on('close', function(code, signal) {
console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
conn.end();
}).on('data', function(data) {
console.log('STDOUT: ' + data);
}).stderr.on('data', function(data) {
console.log('STDERR: ' + data);
});
});
}).connect({
host: 'localhost',
port: 22,
username: '<username>',
password: '<password>'
});
Output is
STDERR:
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
STDERR: E: Invalid operation updat
STDERR:
Stream :: close :: code: 100, signal: undefined
- Ngôn ngữ chính
- TypeScript
- Star
- 1k
- Fork
- 94
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của steelbrain/node-ssh
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
steelbrain/node-ssh#487 ·
-
ssh-certificate supportĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
steelbrain/node-ssh#482 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
steelbrain/node-ssh#474 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
steelbrain/node-ssh#473 · 1 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
steelbrain/node-ssh#472 ·
Tất cả issue của steelbrain/node-ssh
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
cli: `execCargoMetadata` decodes stdout per chunk, corrupting non-ASCII paths across pipe boundariesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
lingdojo/kana-dojo#34127 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
osmlab/name-suggestion-index#13104 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100