Skip to content

Commit

Permalink
Run truffle compile automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
montyly committed Nov 15, 2018
1 parent ddb2ae2 commit 4123987
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions slither/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import sys
import traceback
import subprocess

from pkg_resources import iter_entry_points, require

Expand Down Expand Up @@ -58,6 +59,18 @@ def _process(slither, detector_classes, printer_classes):
return results, analyzed_contracts_count

def process_truffle(dirname, args, detector_classes, printer_classes):
cmd = ['truffle','compile']
logger.info('truffle compile running...')
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

stdout, stderr = process.communicate()
stdout, stderr = stdout.decode(), stderr.decode() # convert bytestrings to unicode strings

logger.info(stdout)

if stderr:
logger.error(stderr)

if not os.path.isdir(os.path.join(dirname, 'build'))\
or not os.path.isdir(os.path.join(dirname, 'build', 'contracts')):
logger.info(red('No truffle build directory found, did you run `truffle compile`?'))
Expand Down

0 comments on commit 4123987

Please sign in to comment.