Skip to content

Commit

Permalink
fix: wrong cwd set to daemon process
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves authored Apr 30, 2024
1 parent 4fa71fd commit ef1756c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions daemon.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import { spawn } from "child_process";
import { openSync } from "fs";
import { join } from "path";
import { join, dirname } from "path";

const logsFolder = process.env.CRON_LOGS_FOLDER || "/tmp/cronjobs";
const stdout = openSync(join(logsFolder, "crond.log"), "a");
const cwd = dirname(process.argv[1]);
const child = spawn("node", ["index.mjs"], {
cwd: process.cwd(),
cwd,
detached: true,
stdio: ["ignore", stdout, stdout],
});
Expand Down

0 comments on commit ef1756c

Please sign in to comment.