如何从node.js打开终端应用程序?

如何从node.js打开终端应用程序?,第1张

如何从node.js打开终端应用程序

您可以从主过程继承stdio。

const child_process = require('child_process')var editor = process.env.EDITOR || 'vi';var child = child_process.spawn(editor, ['/tmp/somefile.txt'], {    stdio: 'inherit'});child.on('exit', function (e, pre) {    console.log("finished");});

此处提供更多选项:http
:
//nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5126955.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-17
下一篇 2022-11-17

发表评论

登录后才能评论

评论列表(0条)

保存