def __call__(self, attempt):
        """Run command on this input and produce verdict"""
        ipath = os.path.join(attempt.workspace, random_string())
        with open(ipath, 'w') as fl:
            fl.write(self.inp)
        cmd = attempt.wrapper.format(input_file=ipath,
                                     code_file=attempt.codepath)
        try:
            p = run(cmd, timeout=self.time_limit,
                    stderr=PIPE, stdout=PIPE,
                    shell=True)
        except TimeoutExpired:
            result = False
            stdout, stderr = b'', b'Timeout'
        else:
            stdout, stderr = p.stdout, p.stderr
            result = p.returncode == 0
            result = result and stdout.decode().strip() == self.out.strip()
        return result, stdout.decode(), stderr.decode()
def __call__ ( self , attempt ) : ipath = os . path . join ( attempt . workspace , random_string ( ) ) with open ( ipath , 'w' ) as fl : fl . write ( self . inp ) cmd = attempt . wrapper . format ( input_file = ipath , code_file = attempt . codepath ) try : p = run ( cmd , timeout = self . time_limit , stderr = PIPE , stdout = PIPE , shell = True ) except TimeoutExpired : result = False stdout , stderr = b'' , b'Timeout' else : stdout , stderr = p . stdout , p . stderr result = p . returncode == 0 result = result and stdout . decode ( ) . strip ( ) == self . out . strip ( ) return result , stdout . decode ( ) , stderr . decode ( )
Run command on this input and produce verdict