child count for verbose output

master
JoYo 2016-07-18 20:12:17 -04:00
parent d93929d8b5
commit 6b7b3ce193
2 changed files with 9 additions and 5 deletions

12
run.py
View File

@ -34,16 +34,17 @@ class Sins():
self.logger.info('parsed\n {}'.format((parsed))) self.logger.info('parsed\n {}'.format((parsed)))
paths = (self.seed) paths = (self.seed)
children = 0
while True: while True:
for path in paths: for path in paths:
scrap_path = os.path.join(self.run_dir, path) scrap_path = os.path.join(self.run_dir, path)
if os.path.isfile(scrap_path): if os.path.isfile(scrap_path):
self.execute( children += self.execute(
self.parent, self.parent,
scrap_path, scrap_path,
self.run_dir self.run_dir
) )
self.logger.info('"children": "{}",'.format(children))
paths = sorted(os.listdir(self.run_dir)) paths = sorted(os.listdir(self.run_dir))
def scrap_recent(self, run_dir): def scrap_recent(self, run_dir):
@ -55,8 +56,10 @@ class Sins():
return None return None
def execute(self, parent, scrap, cwd): def execute(self, parent, scrap, cwd):
self.logger.info('execute\n {}'.format(((parent, scrap, cwd)))) self.logger.debug('execute\n {}'.format(((parent, scrap, cwd))))
subprocess.run([parent, scrap], cwd=cwd) proc = subprocess.run([parent, scrap], cwd=cwd, stdout=subprocess.PIPE)
children = proc.stdout
return int(children)
def hex_dumps(scrap_dir): def hex_dumps(scrap_dir):
@ -122,6 +125,7 @@ if __name__ == '__main__':
else: else:
stream_handler = logging.StreamHandler() stream_handler = logging.StreamHandler()
stream_handler.setFormatter(formatter) stream_handler.setFormatter(formatter)
logger.setLevel(logging.INFO)
logger.addHandler(stream_handler) logger.addHandler(stream_handler)
if args.provision: if args.provision:

2
sins.c
View File

@ -64,7 +64,7 @@ int main(int argc, const char **argv)
return_value = waitpid(iter->process_id, &status, 0); return_value = waitpid(iter->process_id, &status, 0);
return_value = WEXITSTATUS(return_value); return_value = WEXITSTATUS(return_value);
} }
printf("%d", count);
break; break;
} }
} }