【问题标题】:Deno.run has not message output in terminal?Deno.run 在终端没有消息输出?
【发布时间】:2021-09-07 06:13:26
【问题描述】:

在窗口中

以下代码在终端中有输出消息

const p = Deno.run({
    cmd: ['git', 'config', '-l'],
    stdout: 'piped'
})

console.log(new TextDecoder('utf-8').decode(await p.output()))

但以下代码在终端中没有输出消息

const p = Deno.run({
    cmd: ['git', 'config', '-l'],
    stdout: 'inherit',
    stderr: 'inherit
})

【问题讨论】:

  • 你有什么问题?

标签: deno


【解决方案1】:

来自docs

"inherit" 如果未指定,则为默认值。子继承自相应的父描述符。

即如果你想要输出,你应该使用"piped"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-07-11
    • 1970-01-01
    • 2013-11-25
    • 2013-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多