Merge pull request #179 from trailofbits/dev-win-truffle-invoke

Fix Truffle invocation conflict on Windows
pull/181/head
Feist Josselin 6 years ago committed by GitHub
commit 6ca0cc1f67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      slither/__main__.py

@ -6,6 +6,7 @@ import inspect
import json
import logging
import os
import platform
import subprocess
import sys
import traceback
@ -76,8 +77,13 @@ def _process(slither, detector_classes, printer_classes):
return results, analyzed_contracts_count
def process_truffle(dirname, args, detector_classes, printer_classes):
# Truffle on windows has naming conflicts where it will invoke truffle.js directly instead
# of truffle.cmd (unless in powershell or git bash). The cleanest solution is to explicitly call
# truffle.cmd. Reference:
# https://truffleframework.com/docs/truffle/reference/configuration#resolving-naming-conflicts-on-windows
if not args.ignore_truffle_compile:
cmd = ['truffle', 'compile']
truffle_base_command = "truffle" if platform.system() != 'Windows' else "truffle.cmd"
cmd = [truffle_base_command, 'compile']
if args.truffle_version:
cmd = ['npx',args.truffle_version,'compile']
elif os.path.isfile('package.json'):

Loading…
Cancel
Save