diff --git a/backend/src/__tests__/filesystem.test.ts b/backend/src/__tests__/filesystem.test.ts index a67a86e6..ee22cbfc 100644 --- a/backend/src/__tests__/filesystem.test.ts +++ b/backend/src/__tests__/filesystem.test.ts @@ -93,7 +93,7 @@ describe('FileSystemService.deleteStack', () => { await expect(promise).resolves.toBeUndefined(); expect(mockSpawn).toHaveBeenCalledWith( 'docker', - expect.arrayContaining(['run', '--rm', '-v', expect.stringContaining(':/cleanup'), 'alpine', 'rm', '-rf', '/cleanup']), + expect.arrayContaining(['run', '--rm', '-v', expect.stringContaining(':/cleanup'), 'alpine', 'sh', '-c', 'find /cleanup -mindepth 1 -maxdepth 1 -exec rm -rf {} +']), expect.objectContaining({ env: expect.any(Object) }), ); }); diff --git a/backend/src/services/FileSystemService.ts b/backend/src/services/FileSystemService.ts index 8b07a11f..c842b017 100644 --- a/backend/src/services/FileSystemService.ts +++ b/backend/src/services/FileSystemService.ts @@ -205,7 +205,7 @@ export class FileSystemService { 'run', '--rm', '-v', `${dirPath}:/cleanup`, 'alpine', - 'rm', '-rf', '/cleanup' + 'sh', '-c', 'find /cleanup -mindepth 1 -maxdepth 1 -exec rm -rf {} +' ], { env: { ...process.env,