MCPcopy Create free account
hub / github.com/astercloud/aster / cleanupOutputFiles

Method cleanupOutputFiles

pkg/tools/builtin/task_manager.go:616–638  ·  view source on GitHub ↗

cleanupOutputFiles 清理任务的输出文件

(taskID string)

Source from the content-addressed store, hash-verified

614
615// cleanupOutputFiles 清理任务的输出文件
616func (tm *FileTaskManager) cleanupOutputFiles(taskID string) error {
617 tm.mu.RLock()
618 task, exists := tm.tasks[taskID]
619 tm.mu.RUnlock()
620
621 if !exists {
622 return fmt.Errorf("task not found: %s", taskID)
623 }
624
625 outputFile := filepath.Join(task.Options.OutputDir, taskID+".stdout")
626 errorFile := filepath.Join(task.Options.OutputDir, taskID+".stderr")
627
628 // 清空文件内容
629 if err := os.WriteFile(outputFile, []byte{}, 0644); err != nil {
630 return fmt.Errorf("failed to clear output file: %w", err)
631 }
632
633 if err := os.WriteFile(errorFile, []byte{}, 0644); err != nil {
634 return fmt.Errorf("failed to clear error file: %w", err)
635 }
636
637 return nil
638}

Callers 1

ExecuteMethod · 0.80

Calls 1

JoinMethod · 0.45

Tested by

no test coverage detected