( manifest: ExecutorLocalServerManifest, )
| 48 | }); |
| 49 | |
| 50 | export const writeLocalServerManifest = ( |
| 51 | manifest: ExecutorLocalServerManifest, |
| 52 | ): Effect.Effect<void, PlatformError, FileSystem.FileSystem | Path.Path> => |
| 53 | Effect.gen(function* () { |
| 54 | const fs = yield* FileSystem.FileSystem; |
| 55 | const path = yield* Path.Path; |
| 56 | yield* fs.makeDirectory(serverControlDir(path), { recursive: true }); |
| 57 | const manifestPath = localServerManifestPath(path); |
| 58 | // The manifest embeds the bearer token; create it owner-only so there's no |
| 59 | // window where it exists world-readable (mode applies only on create). The |
| 60 | // chmod after covers overwriting a pre-existing world-readable file, where |
| 61 | // the create mode is ignored. |
| 62 | yield* fs.writeFileString(manifestPath, serializeExecutorLocalServerManifest(manifest), { |
| 63 | mode: 0o600, |
| 64 | }); |
| 65 | yield* fs.chmod(manifestPath, 0o600).pipe(Effect.ignore); |
| 66 | }); |
| 67 | |
| 68 | export const removeLocalServerManifestIfOwnedBy = (input: { |
| 69 | readonly pid: number; |
no test coverage detected