diff --git a/src/main/services/aria2c.ts b/src/main/services/aria2c.ts index b1b1da76..37164e3a 100644 --- a/src/main/services/aria2c.ts +++ b/src/main/services/aria2c.ts @@ -7,14 +7,35 @@ export const startAria2 = () => { ? path.join(process.resourcesPath, "aria2", "aria2c") : path.join(__dirname, "..", "..", "aria2", "aria2c"); - return spawn( + const aria2Process = spawn( binaryPath, [ "--enable-rpc", "--rpc-listen-all", "--file-allocation=none", "--allow-overwrite=true", + "--log-level=debug", + "--no-conf", + "--disk-cache=128M", + "-x16", + "-s16", ], { stdio: "inherit", windowsHide: true } ); + + aria2Process.on("error", (err) => { + console.error("Aria2 process error:", err); + }); + + aria2Process.on("exit", (code, signal) => { + if (code !== 0) { + console.error( + `Aria2 process exited with code ${code} and signal ${signal}` + ); + } else { + console.log("Aria2 process exited successfully"); + } + }); + + return aria2Process; };