2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

coredump: convert indentation to spaces

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
This commit is contained in:
Radostin Stoyanov 2021-09-05 21:34:00 +01:00 committed by Andrei Vagin
parent bf8a3c9f62
commit c71a81a6bd
3 changed files with 29 additions and 27 deletions

View File

@ -3,4 +3,4 @@
import coredump import coredump
if __name__ == '__main__': if __name__ == '__main__':
coredump.main() coredump.main()

View File

@ -3,4 +3,4 @@
import coredump import coredump
if __name__ == '__main__': if __name__ == '__main__':
coredump.main() coredump.main()

View File

@ -3,37 +3,39 @@ import os
import criu_coredump import criu_coredump
def coredump(opts): def coredump(opts):
generator = criu_coredump.coredump_generator() generator = criu_coredump.coredump_generator()
cores = generator(os.path.realpath(opts['in'])) cores = generator(os.path.realpath(opts['in']))
for pid in cores: for pid in cores:
if opts['pid'] and pid != opts['pid']: if opts['pid'] and pid != opts['pid']:
continue continue
with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f: with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f:
cores[pid].write(f) cores[pid].write(f)
def main(): def main():
desc = 'CRIU core dump' desc = 'CRIU core dump'
parser = argparse.ArgumentParser(description=desc, parser = argparse.ArgumentParser(description=desc,
formatter_class=argparse.RawTextHelpFormatter) formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-i', parser.add_argument('-i',
'--in', '--in',
default = '.', default='.',
help = 'directory where to get images from') help='directory where to get images from')
parser.add_argument('-p', parser.add_argument('-p',
'--pid', '--pid',
type = int, type=int,
help = 'generate coredump for specific pid(all pids py default)') help='generate coredump for specific pid(all pids py default)')
parser.add_argument('-o', parser.add_argument('-o',
'--out', '--out',
default = '.', default='.',
help = 'directory to write coredumps to') help='directory to write coredumps to')
opts = vars(parser.parse_args()) opts = vars(parser.parse_args())
coredump(opts)
coredump(opts)
if __name__ == '__main__': if __name__ == '__main__':
main() main()