TableGenerator: improve opening of table afterwards.
Linux and Windows versions are working.
Darwin not yet tested.
@@ -15,6 +15,7 @@ import io
import itertools
import logging
import os.path
+import platform
import signal
import subprocess
import sys
@@ -1391,7 +1392,17 @@ def write_table_in_format(template_format, outfile, options, **kwargs):
callback(out, options=options, **kwargs)
if options.show_table and template_format == "html":
+ system = platform.system()
try:
+ if system == "Windows":
+ os.startfile(outfile, "open")
+ elif system == "Darwin":
+ subprocess.Popen(
+ ["open", outfile],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ )
+ else: # system == "Linux":
subprocess.Popen(
["xdg-open", outfile],
stdout=subprocess.DEVNULL,
