MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / writeResponse

Function writeResponse

src/session.ts:717–733  ·  view source on GitHub ↗
(responseData: Record<string, unknown>, responseSessionDir: string)

Source from the content-addressed store, hash-verified

715}
716
717export async function writeResponse(responseData: Record<string, unknown>, responseSessionDir: string): Promise<void> {
718
719 const responseFile = path.join(responseSessionDir, 'response.log');
720 const responseLockFile = path.join(responseSessionDir, 'response.lock');
721 if (!fs.existsSync(responseFile) || !fs.existsSync(responseLockFile)) {
722 throw ('Received a request from R for response' +
723 'to a session directiory that does not contain response.log or response.lock: ' +
724 responseSessionDir);
725 }
726 const responseString = JSON.stringify(responseData);
727 console.info('[writeResponse] Started');
728 console.info(`[writeResponse] responseData ${responseString}`);
729 console.info(`[writeRespnse] responseFile: ${responseFile}`);
730 await fs.writeFile(responseFile, responseString);
731 responseTimeStamp = Date.now();
732 await fs.writeFile(responseLockFile, `${responseTimeStamp}\n`);
733}
734
735export async function writeSuccessResponse(responseSessionDir: string): Promise<void> {
736 await writeResponse({ result: true }, responseSessionDir);

Callers 2

dispatchRStudioAPICallFunction · 0.90
writeSuccessResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected