Mercurial > libervia-backend
comparison sat_frontends/jp/cmd_blog.py @ 2998:a1b98772af6b
Backed out changeset cf0dda0d4cda
check_output can't be used as it's waiting for command to return, blocking the edition.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 12 Jul 2019 09:04:45 +0200 |
parents | cf0dda0d4cda |
children | d603550d5e99 |
comparison
equal
deleted
inserted
replaced
2997:cf0dda0d4cda | 2998:a1b98772af6b |
---|---|
512 meta_ori, meta_file_path = self.buildMetadataFile(content_file_path, mb_data) | 512 meta_ori, meta_file_path = self.buildMetadataFile(content_file_path, mb_data) |
513 | 513 |
514 # do we need a preview ? | 514 # do we need a preview ? |
515 if self.args.preview: | 515 if self.args.preview: |
516 self.disp(u"Preview requested, launching it", 1) | 516 self.disp(u"Preview requested, launching it", 1) |
517 # we redirect stderr to stdout and capture output to avoid console pollution | 517 # we redirect outputs to /dev/null to avoid console pollution in editor |
518 # in editor. | 518 # if user wants to see messages, (s)he can call "blog preview" directly |
519 # If user wants to see messages, (s)he can call "blog preview" directly | 519 DEVNULL = open(os.devnull, "wb") |
520 try: | 520 subprocess.Popen( |
521 subprocess.check_output( | 521 [ |
522 [ | 522 sys.argv[0], |
523 sys.argv[0], | 523 "blog", |
524 "blog", | 524 "preview", |
525 "preview", | 525 "--inotify", |
526 "--inotify", | 526 "true", |
527 "true", | 527 "-p", |
528 "-p", | 528 self.profile, |
529 self.profile, | 529 content_file_path, |
530 content_file_path, | 530 ], |
531 ], | 531 stdout=DEVNULL, |
532 stderr=subprocess.STDOUT, | 532 stderr=subprocess.STDOUT, |
533 ) | 533 ) |
534 except Exception as e: | |
535 self.disp(u"Can't show preview: {msg}".format( | |
536 msg=e.output.decode('utf-8'), err=True)) | |
537 sys.exit(e.returncode) | |
538 | 534 |
539 # we launch editor | 535 # we launch editor |
540 self.runEditor( | 536 self.runEditor( |
541 "blog_editor_args", | 537 "blog_editor_args", |
542 content_file_path, | 538 content_file_path, |