fix deleting reports

pull/1496/head
yann300 3 years ago
parent 91da1ef02f
commit 02effc55c1
  1. 12
      libs/remixd/src/services/slitherClient.ts

@ -2,9 +2,9 @@
import * as WS from 'ws' // eslint-disable-line
import { PluginClient } from '@remixproject/plugin'
import { existsSync, readFileSync, readdirSync } from 'fs'
import { existsSync, readFileSync, readdirSync, unlink } from 'fs'
import { OutputStandard } from '../types' // eslint-disable-line
const { spawn, execSync, unlink } = require('child_process')
const { spawn, execSync } = require('child_process')
export class SlitherClient extends PluginClient {
methods: Array<string>
@ -151,8 +151,12 @@ export class SlitherClient extends PluginClient {
let report = readFileSync(outputFileAbsPath, 'utf8')
report = JSON.parse(report)
try {
unlink(outputFileAbsPath)
} catch (e) {}
unlink(outputFileAbsPath, (err) => {
console.log(err)
})
} catch (e) {
console.log(e)
}
if (report['success']) {
response['status'] = true
if (!report['results'] || !report['results'].detectors || !report['results'].detectors.length) {

Loading…
Cancel
Save