linux 重定向 unbuffer,如何将`git clone`的完整输出重定向到一个文件?

$ git clone https://github.com/bensmithett/webpack-css-example

Cloning into 'webpack-css-example'...

remote: Counting objects: 179, done.

remote: Total 179 (delta 0), reused 0 (delta 0), pack-reused 179

Receiving objects: 100% (179/179), 24.07 KiB | 0 bytes/s, done.

Resolving deltas: 100% (79/79), done.

Checking connectivity... done

然而,当我试图将其重定向到一个文件,我只看到这一点:

Cloning into 'webpack-css-example'...

这里是我的尝试:

$ git clone https://github.com/bensmithett/webpack-css-example 2>&1 | tee out.log

$ cat out.log

Cloning into 'sample-data'...

我在Node.js的试了一下为好,它做同样的事情:

const fs = require('fs');

const child = spawn('git clone https://github.com/bensmithett/webpack-css-example');

child.stdout.on('data', function(data){

console.log(String(data));

});

child.stderr.on('data', function(data){

console.log(String(data));

});

// Cloning into 'webpack-css-example'...

为什么所有的remote:等东西没有通过管道连接到stdin/stderr?有什么方法可以捕获输出吗?如果没有,发生了什么事情使得输出显示在终端中,但它没有通过stdout或stderr传递?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值