Skip to content
Snippets Groups Projects
Commit 401efbb5 authored by tuhe's avatar tuhe
Browse files

updatse

parent 4fedca49
No related branches found
No related tags found
No related merge requests found
# Use this guide: # Use this guide:
# https://packaging.python.org/tutorials/packaging-projects/ # https://packaging.python.org/tutorials/packaging-projects/
# py -m build && twine upload dist/* # py -m build && twine upload dist/*
# LINUX: python -m build && twine upload dist/* # LINUX: python -m build && python -m twine upload dist/*
# Local install: sudo pip install -e ./ # Local install: sudo pip install -e ./
......
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: unitgrade-devel Name: unitgrade-devel
Version: 0.1.52 Version: 0.1.53
Summary: A set of tools to develop unitgrade tests and reports and later evaluate them Summary: A set of tools to develop unitgrade tests and reports and later evaluate them
Home-page: https://lab.compute.dtu.dk/tuhe/unitgrade_private Home-page: https://lab.compute.dtu.dk/tuhe/unitgrade_private
Author: Tue Herlau Author: Tue Herlau
......
...@@ -3,10 +3,9 @@ import select ...@@ -3,10 +3,9 @@ import select
import subprocess import subprocess
import sys import sys
# logger = logging.getLogger() # logger = logging.getLogger()
def run(cmd: str | list, print_output=True, log_output=False, check=True, *args, **kwargs) -> subprocess.Popen: def run(cmd : str | list, print_output=True, log_output=False, check=True, *args, **kwargs) -> subprocess.Popen:
"""Run a command, with superpowers """Run a command, with superpowers
* cmd: The command to run. If a string, it will be passed to a shell. * cmd: The command to run. If a string, it will be passed to a shell.
...@@ -30,6 +29,24 @@ def run(cmd: str | list, print_output=True, log_output=False, check=True, *args, ...@@ -30,6 +29,24 @@ def run(cmd: str | list, print_output=True, log_output=False, check=True, *args,
The Popen object is always returned. The Popen object is always returned.
""" """
shell = isinstance(cmd, str) shell = isinstance(cmd, str)
import os
if os.name == "nt": # th juli 2023: annoying winows problem.
print("Warning, due to problem on windows the console output will not be shown while the command is runnign (error due to select.select).")
import subprocess
p = subprocess.run(cmd, shell=True, encoding="utf-8", capture_output=True)
# out_ = p.stdout
# err_ = p.stderr
class std_:
def __init__(self, s):
self.s = s
def getvalue(self):
return self.s
p.stdout = std_(p.stdout)
p.stderr = std_(p.stderr)
return p
# logger.debug(f"Running command: {cmd}") # logger.debug(f"Running command: {cmd}")
process = subprocess.Popen( process = subprocess.Popen(
......
__version__ = "0.1.52" __version__ = "0.1.53"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment