mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 04:02:54 -06:00
fix: change execSync to execFileSync
This commit is contained in:
parent
427c994993
commit
2a020928e8
@ -1,7 +1,7 @@
|
|||||||
import { Auth, ConfigService, ProviderSession } from '@config/env.config';
|
import { Auth, ConfigService, ProviderSession } from '@config/env.config';
|
||||||
import { Logger } from '@config/logger.config';
|
import { Logger } from '@config/logger.config';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { execSync } from 'child_process';
|
import { execFileSync } from 'child_process';
|
||||||
|
|
||||||
type ResponseSuccess = { status: number; data?: any };
|
type ResponseSuccess = { status: number; data?: any };
|
||||||
type ResponseProvider = Promise<[ResponseSuccess?, Error?]>;
|
type ResponseProvider = Promise<[ResponseSuccess?, Error?]>;
|
||||||
@ -36,7 +36,7 @@ export class ProviderFiles {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(['Failed to connect to the file server', error?.message, error?.stack]);
|
this.logger.error(['Failed to connect to the file server', error?.message, error?.stack]);
|
||||||
const pid = process.pid;
|
const pid = process.pid;
|
||||||
execSync(`kill -9 ${pid}`);
|
execFileSync('kill', ['-9', `${pid}`]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import { CacheConf, Chatwoot, ConfigService, Database, DelInstance, ProviderSess
|
|||||||
import { Logger } from '@config/logger.config';
|
import { Logger } from '@config/logger.config';
|
||||||
import { INSTANCE_DIR, STORE_DIR } from '@config/path.config';
|
import { INSTANCE_DIR, STORE_DIR } from '@config/path.config';
|
||||||
import { NotFoundException } from '@exceptions';
|
import { NotFoundException } from '@exceptions';
|
||||||
import { execSync } from 'child_process';
|
import { execFileSync } from 'child_process';
|
||||||
import EventEmitter2 from 'eventemitter2';
|
import EventEmitter2 from 'eventemitter2';
|
||||||
import { rmSync } from 'fs';
|
import { rmSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
@ -168,7 +168,8 @@ export class WAMonitoringService {
|
|||||||
|
|
||||||
public async cleaningStoreData(instanceName: string) {
|
public async cleaningStoreData(instanceName: string) {
|
||||||
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED) {
|
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED) {
|
||||||
execSync(`rm -rf ${join(STORE_DIR, 'chatwoot', instanceName + '*')}`);
|
const instancePath = join(STORE_DIR, 'chatwoot', `${instanceName}*`);
|
||||||
|
execFileSync('rm', ['-rf', instancePath]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const instance = await this.prismaRepository.instance.findFirst({
|
const instance = await this.prismaRepository.instance.findFirst({
|
||||||
|
Loading…
Reference in New Issue
Block a user