def stop(self):
        if self.stopped:
            return

        stdout = open(os.devnull, "w+")
        stderr = open(os.devnull, "w+")
        # For debugging squid, uncomment the next line
        #stderr = None

        # Insist on killing squid
        for i in range(5):
            p = subprocess.Popen(self.getStopCmd(), stdout=stdout, stderr=stderr)
            ret = p.wait()
            if ret == 0:
                break
            time.sleep(.1)

        if ret != 0:
            sys.stderr.write("Unable to stop squid with config file %s: %s\n" %
                (self.configFile, ret))
            # Try harder to kill it
            sys.stderr.write(self.pid % "Killing squid process %d\n")
            try:
                os.kill(self.pid, 15)
                time.sleep(1)
                os.kill(self.pid, 9)
            except OSError, e:
                if e.errno != 3: # No such process
                    raise
            if os.path.exists(self.pidFile):
                os.unlink(self.pidFile)

        self.stopped = True
dataset/ETHPy150Open sassoftware/conary/conary_test/rephelp.py/HTTPProxy.stop/swapped operands of `%`