Skip to content

Cleanup should rmSync only if isTemp== true #30

@KrishnaPG

Description

@KrishnaPG

chdb-node/index.js

Lines 45 to 49 in 884d7b5

// Cleanup method to delete the temporary directory
cleanup() {
rmSync(this.path, { recursive: true }); // Replaced rmdirSync with rmSync
}
}

Currently the cleanup method is removing the folder even when it is user-supplied folder and not a temp directory.

The rmSync should only be called when mkdtempSync is called, i.e. when this.isTemp == true;

When users supply their own path, the cleanup will endup deleting their other data, which is a side-effect and not suggestable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions