How to use the pywatchman.encoding.decode_local function in pywatchman

To help you get started, we’ve selected a few pywatchman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / watchman / tests / integration / test_bser_cli.py View on Github external
"-j",
        ]
        proc = subprocess.Popen(
            cli_cmd,
            stdin=subprocess.PIPE,
            stderr=subprocess.PIPE,
            stdout=subprocess.PIPE,
        )

        stdout, stderr = proc.communicate(input=watchman_cmd)
        self.assertEqual(proc.poll(), 0, stderr)
        # the response should be bser to match our input
        result = bser.loads(stdout)
        result_sockname = result["sockname"]
        if compat.PYTHON3:
            result_sockname = encoding.decode_local(result_sockname)
        self.assertEqual(
            result_sockname, sockname, binascii.hexlify(stdout).decode("ascii")
        )