How to use the vaping.io.subprocess function in vaping

To help you get started, we’ve selected a few vaping 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 20c / vaping / vaping / plugins / fping_mtr.py View on Github external
# -f first_ttl
        # -m max_ttl
        args = [
            command,
            '-n',
            # -w wait time seconds
            '-w1',
            # -q number of queries
            '-q1',
            self.mtr_host,
        ]

        # get both stdout and stderr
        proc = self.popen(args, stdout=subprocess.PIPE,
                          stderr=subprocess.STDOUT)

        with proc.stdout:
            hosts = self.parse_traceroute(iter(proc.stdout.readline, b''))
        return hosts
github 20c / vaping / vaping / plugins / fping.py View on Github external
def _run_proc(self):
        args = [
            self.config['command'],
            '-u',
            '-C%d' % self.count,
            '-p%d' % self.period,
            '-e'
        ]
        args.extend(self.hosts_args())
        data = list()

        # get both stdout and stderr
        proc = self.popen(args, stdout=subprocess.PIPE,
                          stderr=subprocess.STDOUT)

        # TODO poll, timeout, maybe from parent process for better control?
        with proc.stdout:
            for line in iter(proc.stdout.readline, b''):
                data.append(self.parse_verbose(line.decode("utf-8")))

        return data