CLI
CLI copied to clipboard
child_process calling bito returns empty
Can you tell me why this code doesn't work?
import child_process from "child_process";
const cmd = child_process.exec("bito -p I:/creator/gitbitoCLI/version-3.0/1.txt -f I:/creator/gitbitoCLI/version-3.0/2.txt", {
cwd: "I:/creator/gitbitoCLI/version-3.0/",
encoding: "utf8",
});
let result_s = "";
cmd.stdout!.on("data", (message: Buffer) => {
result_s += message.toString();
});
const result = new Promise<string>((resolve_f) => {
cmd.on("close", () => {
console.log("result: ", result_s);
resolve_f(result_s);
});
});
官方应该不推荐这样使用cli吧?否则也不会用Ctrl D(也就是EOF,这是一个无法用程序模拟提交到控制台的快捷键)做提交了.你这个问题大概是因为bito第一次使用的时候需要用邮箱验证,你可以试试先用对应的用户做一下验证,生成~/.bito的目录,然后再用程序跑跑看.
Hi @1226085293,
We did try to reproduce the issue you are facing. Although it dint give the expected output but it was able to make validations as you might see in the screenshots attached below. So you shouldn't at least get an empty result. Check if your path or filename were correct.
We will look in to this issue of why it isn't giving an expected output and just keeps waiting.
Thanks,