Skip to content

Commit

Permalink
feat(#9): with
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed Jul 8, 2024
1 parent a04a439 commit 35bd496
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions sr-data/src/sr_data/tasks/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,29 @@ def main(config=default):
--tokens {config["tokens"]}
"""
try:
process = subprocess.Popen(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
break
if output:
print(output.strip())
err = process.stderr.read()
if err:
print(f"Error: {err.strip()}")
process.wait()
if process.returncode != 0:
raise subprocess.CalledProcessError(
process.returncode,
with subprocess.Popen(
cmd,
output=process.stdout.read(),
stderr=err
)
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
) as process:
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
break
if output:
print(output.strip())
err = process.stderr.read()
if err:
print(f"Error: {err.strip()}")
process.wait()
if process.returncode != 0:
raise subprocess.CalledProcessError(
process.returncode,
cmd,
output=process.stdout.read(),
stderr=err
)
except subprocess.CalledProcessError as e:
print(f"Something went wrong: {e.stderr}")

0 comments on commit 35bd496

Please sign in to comment.