Merge pull request #3816 from ethereum/fix_slither_output

Remove slither result before doing another analysis
pull/3821/head
yann300 1 year ago committed by GitHub
commit 853e98d120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      libs/remixd/src/services/slitherClient.ts

@ -2,7 +2,7 @@
import * as WS from 'ws' // eslint-disable-line
import { PluginClient } from '@remixproject/plugin'
import { existsSync, readFileSync, readdirSync, unlink } from 'fs'
import { existsSync, readFileSync, readdirSync, unlinkSync } from 'fs'
import { OutputStandard } from '../types' // eslint-disable-line
import * as utils from '../utils'
const { spawn, execSync } = require('child_process') // eslint-disable-line
@ -136,6 +136,14 @@ export class SlitherClient extends PluginClient {
const solcRemaps = remaps ? `--solc-remaps "${remaps}"` : ''
const outputFile = 'remix-slither-report.json'
try {
// We don't keep the previous analysis
const outputFilePath = utils.absolutePath(outputFile, this.currentSharedFolder)
if (existsSync(outputFilePath)) unlinkSync(outputFilePath)
} catch (e) {
console.error('unable to remove the output file')
console.error(e.message)
}
const cmd = `slither ${filePath} ${solcArgs} ${solcRemaps} --json ${outputFile}`
console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Running Slither...')
// Added `stdio: 'ignore'` as for contract with NPM imports analysis which is exported in 'stderr'

Loading…
Cancel
Save