MCPcopy
hub / github.com/coder/mux / copyFileBestEffort

Function copyFileBestEffort

src/node/services/workspaceService.ts:948–970  ·  view source on GitHub ↗
(params: {
  srcPath: string;
  destPath: string;
  logContext: Record<string, unknown>;
})

Source from the content-addressed store, hash-verified

946}
947
948async 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.

Calls 2

isErrnoWithCodeFunction · 0.90
getErrorMessageFunction · 0.90

Tested by

no test coverage detected