From 6b7b3ce1930373831fbd14f445d17cbbdbad5b18 Mon Sep 17 00:00:00 2001 From: JoYo Date: Mon, 18 Jul 2016 20:12:17 -0400 Subject: [PATCH] child count for verbose output --- run.py | 12 ++++++++---- sins.c | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/run.py b/run.py index f0c3078..4a260cf 100644 --- a/run.py +++ b/run.py @@ -34,16 +34,17 @@ class Sins(): self.logger.info('parsed\n {}'.format((parsed))) paths = (self.seed) - + children = 0 while True: for path in paths: scrap_path = os.path.join(self.run_dir, path) if os.path.isfile(scrap_path): - self.execute( + children += self.execute( self.parent, scrap_path, self.run_dir ) + self.logger.info('"children": "{}",'.format(children)) paths = sorted(os.listdir(self.run_dir)) def scrap_recent(self, run_dir): @@ -55,8 +56,10 @@ class Sins(): return None def execute(self, parent, scrap, cwd): - self.logger.info('execute\n {}'.format(((parent, scrap, cwd)))) - subprocess.run([parent, scrap], cwd=cwd) + self.logger.debug('execute\n {}'.format(((parent, scrap, cwd)))) + proc = subprocess.run([parent, scrap], cwd=cwd, stdout=subprocess.PIPE) + children = proc.stdout + return int(children) def hex_dumps(scrap_dir): @@ -122,6 +125,7 @@ if __name__ == '__main__': else: stream_handler = logging.StreamHandler() stream_handler.setFormatter(formatter) + logger.setLevel(logging.INFO) logger.addHandler(stream_handler) if args.provision: diff --git a/sins.c b/sins.c index f351d1c..2c041dc 100644 --- a/sins.c +++ b/sins.c @@ -64,7 +64,7 @@ int main(int argc, const char **argv) return_value = waitpid(iter->process_id, &status, 0); return_value = WEXITSTATUS(return_value); } - + printf("%d", count); break; } }