(params: {
srcPath: string;
destPath: string;
logContext: Record<string, unknown>;
})
| 946 | } |
| 947 | |
| 948 | async function copyFileBestEffort(params: { |
| 949 | srcPath: string; |
| 950 | destPath: string; |
| 951 | logContext: Record<string, unknown>; |
| 952 | }): Promise<boolean> { |
| 953 | try { |
| 954 | await fsPromises.mkdir(path.dirname(params.destPath), { recursive: true }); |
| 955 | await fsPromises.copyFile(params.srcPath, params.destPath); |
| 956 | return true; |
| 957 | } catch (error: unknown) { |
| 958 | if (isErrnoWithCode(error, "ENOENT")) { |
| 959 | return false; |
| 960 | } |
| 961 | |
| 962 | log.error("Failed to copy session artifact file", { |
| 963 | ...params.logContext, |
| 964 | srcPath: params.srcPath, |
| 965 | destPath: params.destPath, |
| 966 | error: getErrorMessage(error), |
| 967 | }); |
| 968 | return false; |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | /** |
| 973 | * Concatenate source files (skipping missing ones) into destPath. |
no test coverage detected