MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / initTaskOutputAsSymlink

Function initTaskOutputAsSymlink

source code/utils/task/diskOutput.ts:429–453  ·  view source on GitHub ↗
(
  taskId: string,
  targetPath: string,
)

Source from the content-addressed store, hash-verified

427 * Tries to create the symlink first; if a file already exists, removes it and retries.
428 */
429export function initTaskOutputAsSymlink(
430 taskId: string,
431 targetPath: string,
432): Promise<string> {
433 return track(
434 (async () => {
435 try {
436 await ensureOutputDir()
437 const outputPath = getTaskOutputPath(taskId)
438
439 try {
440 await symlink(targetPath, outputPath)
441 } catch {
442 await unlink(outputPath)
443 await symlink(targetPath, outputPath)
444 }
445
446 return outputPath
447 } catch (error) {
448 logError(error)
449 return initTaskOutput(taskId)
450 }
451 })(),
452 )
453}

Callers 4

clearConversationFunction · 0.85
registerMainSessionTaskFunction · 0.85
registerAsyncAgentFunction · 0.85
registerAgentForegroundFunction · 0.85

Calls 6

trackFunction · 0.85
ensureOutputDirFunction · 0.85
getTaskOutputPathFunction · 0.85
unlinkFunction · 0.85
initTaskOutputFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected