def METHOD_NAME(self, command, verify=None, gmalloc=None, columns=True):
    env = os.environ.copy()
    if (gmalloc is not None and gmalloc) or \
       (gmalloc is None and self.gmalloc):
        env['MallocGuardEdges']      = '1'
        env['MallocScribble']        = '1'
        env['MallocPreScribble']     = '1'
        env['MallocCheckHeapStart']  = '1000'
        env['MallocCheckHeapEach']   = '10000'
        env['DYLD_INSERT_LIBRARIES'] = '/usr/lib/libgmalloc.dylib'
        env['MALLOC_PROTECT_BEFORE'] = '1'
        env['MALLOC_FILL_SPACE']     = '1'
        env['MALLOC_STRICT_SIZE']    = '1'
    if (verify is not None and verify) or \
       (verify is None and self.verify):
        insert = ' --verify'
    else:
        insert = ''
    if columns:
        insert += ' --columns=80'
    command = command.replace('$ledger', '"%s"%s %s' % \
                     (self.ledger, insert, '--args-only'))
    valgrind = '/usr/bin/valgrind'
    if not os.path.isfile(valgrind):
        valgrind = '/opt/local/bin/valgrind'
    if os.path.isfile(valgrind) and '--verify' in insert:
        command = valgrind + ' -q ' + command
    # If we are running under msys2, use bash to execute the test commands
    if 'MSYSTEM' in os.environ:
        bash_path = os.environ['MINGW_PREFIX'] + '/../usr/bin/bash.exe'
        return Popen([bash_path, '-c', command], shell=False,
                     close_fds=False, env=env, stdin=PIPE, stdout=PIPE,
                     stderr=PIPE, cwd=self.sourcepath)
    return Popen(command, shell=True, close_fds=True, env=env,
                 stdin=PIPE, stdout=PIPE, stderr=PIPE, 
                 cwd=self.sourcepath)