Skip to content

Commit 69ea1cd

Browse files
committed
fix(unix-files): replace exec with execFile for deletion in unix
1 parent b27f3df commit 69ea1cd

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

src/core/services/files/unix-files.service.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { exec } from 'child_process';
1+
import { execFile } from 'child_process';
22

33
import { FileService } from './files.service.js';
4-
import { Observable, Subject } from 'rxjs';
54
import { StreamService } from '../stream.service.js';
65
import { FileWorkerService } from './files.worker.service.js';
7-
import { ScanOptions } from '@core/index.js';
86

97
export class UnixFilesService extends FileService {
108
constructor(
@@ -16,16 +14,11 @@ export class UnixFilesService extends FileService {
1614

1715
async deleteDir(path: string): Promise<boolean> {
1816
return new Promise((resolve, reject) => {
19-
const command = `rm -rf "${path}"`;
20-
exec(command, (error, stdout, stderr) => {
21-
if (error !== null) {
17+
execFile('rm', ['-rf', path], (error) => {
18+
if (error) {
2219
reject(error);
2320
return;
2421
}
25-
if (stderr !== '') {
26-
reject(stderr);
27-
return;
28-
}
2922
resolve(true);
3023
});
3124
});

0 commit comments

Comments
 (0)