File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import path from "node:path";
22import { readFile } from "../utilities/fileSystem.js" ;
33import { tryCatch } from "@trigger.dev/core/utils" ;
44import { logger } from "../utilities/logger.js" ;
5- import { writeFile } from "node:fs/promises" ;
5+ import { mkdir , writeFile } from "node:fs/promises" ;
66import { existsSync , unlinkSync } from "node:fs" ;
77import { onExit } from "signal-exit" ;
88
@@ -76,7 +76,7 @@ export async function createLockFile(cwd: string) {
7676 }
7777
7878 // Now write the current pid to the lockfile
79- await writeFile ( lockFilePath , currentPid . toString ( ) ) ;
79+ await writeFileAndEnsureDirExists ( lockFilePath , currentPid . toString ( ) ) ;
8080
8181 logger . debug ( "Lockfile created" , { lockFilePath, currentPid } ) ;
8282
@@ -85,3 +85,9 @@ export async function createLockFile(cwd: string) {
8585 removeLockFile ( ) ;
8686 } ;
8787}
88+
89+ async function writeFileAndEnsureDirExists ( filePath : string , data : string ) {
90+ const dir = path . dirname ( filePath ) ;
91+ await mkdir ( dir , { recursive : true } ) ;
92+ await writeFile ( filePath , data ) ;
93+ }
You can’t perform that action at this time.
0 commit comments