【发布时间】:2021-06-22 15:22:09
【问题描述】:
我创建了一个节点脚本,它应该作为后台进程运行。在脚本开始运行运行后,我需要获取一些用户数据(用户名和密码)。
获取用户数据后,我希望关闭终端,但该进程应继续在后台运行。
更复杂的是,节点脚本是使用 pkg lib 构建的,并将作为 .exe 启动
下面是将要执行的代码:
async function init() {
try {
await fetchConfig();
const credentials = await getCredentials(); // this one prompts the request for user input
watchForNewFiles(credentials); // that one should use the credentials and continue running in the background.
} catch (e) {
console.error(e);
}
}
init();
【问题讨论】:
-
请显示代码... :)
-
@NelsonTeixeira 更新
标签: javascript node.js terminal