Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

备稿计划: Deno.run 的局限 #121

Open
iugo opened this issue Sep 9, 2022 · 0 comments
Open

备稿计划: Deno.run 的局限 #121

iugo opened this issue Sep 9, 2022 · 0 comments

Comments

@iugo
Copy link
Member

iugo commented Sep 9, 2022

Deno.run 可以以子进程的方式调用系统应用, 但是也存在一些局限.

cmd 参数中不支持使用变量. 比如我们直接运行 echo $ABC 可以, 但通过 Deno.run({cmd: ['echo', '$ABC']}) 则无法得到预期结果. deno 对字符串进行了特殊处理, 比如实际执行的是 echo \$ABC.

cmd 参数中不支持设置变量. 比如我们常见的 export ABC=1, 在 Deno.run 中不支持. 解决方法是通过 env 参数来设置环境变量.

另外, 当前版本 1.25.1 中, Deno.run 与 Deno.test 还有不兼容的问题. 具体会单独建 gist. https://gist.github.com/iugo/66cf24ad826734d611e4b348f4308adf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant