From 357b11885872dfd59ef608a5c025147ccfac1ea1 Mon Sep 17 00:00:00 2001 From: Phieu Dinh <42538587+dinhphieu@users.noreply.github.com> Date: Wed, 13 Nov 2024 05:34:34 +0700 Subject: [PATCH] fix: error in windows "Error: EPERM: operation not permitted, unlink" (#134) Co-authored-by: Phieu DINH Co-authored-by: Azlam <43767972+azlam-abdulsalam@users.noreply.github.com> --- src/core/artifacts/generators/ArtifactGenerator.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/artifacts/generators/ArtifactGenerator.ts b/src/core/artifacts/generators/ArtifactGenerator.ts index 696771ed6..c89344667 100644 --- a/src/core/artifacts/generators/ArtifactGenerator.ts +++ b/src/core/artifacts/generators/ArtifactGenerator.ts @@ -39,7 +39,8 @@ export default class ArtifactGenerator { rimraf.sync(path.join(sfpPackage.workingDirectory, '.sfdx')); fs.copySync(sfpPackage.workingDirectory, sourcePackage); - rimraf.sync(sfpPackage.workingDirectory); + // rimraf.sync(sfpPackage.workingDirectory); // This gives an error in windows "Error: EPERM: operation not permitted, unlink" https://github.com/flxbl-io/sfp/issues/128 + rimraf.moveRemoveSync(sfpPackage.workingDirectory); //Modify Source Directory to the new source directory inside the artifact sfpPackage.sourceDir = `source`; @@ -82,7 +83,8 @@ export default class ArtifactGenerator { ); // Cleanup unzipped artifact - rimraf.sync(artifactFilepath); + // rimraf.sync(artifactFilepath); // This gives an error in windows "Error: EPERM: operation not permitted, unlink" https://github.com/flxbl-io/sfp/issues/128 + rimraf.moveRemoveSync(artifactFilepath); return zipArtifactFilepath; } catch (error) {