mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-06 02:32:40 +00:00
alternative run script
This commit is contained in:
parent
47874e5a25
commit
0aab982d64
2 changed files with 15 additions and 6 deletions
|
@ -153,6 +153,7 @@ def build_image(
|
||||||
return_code = run_with_pty(args)
|
return_code = run_with_pty(args)
|
||||||
else:
|
else:
|
||||||
return_code = run_command(args)
|
return_code = run_command(args)
|
||||||
|
print("return code", return_code)
|
||||||
|
|
||||||
if return_code != 0:
|
if return_code != 0:
|
||||||
log.error(
|
log.error(
|
||||||
|
|
|
@ -99,9 +99,17 @@ def run_with_pty(command):
|
||||||
|
|
||||||
|
|
||||||
def run_command(command):
|
def run_command(command):
|
||||||
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
try:
|
||||||
output, error = process.communicate()
|
result = subprocess.run(command, capture_output=True, text=True, check=True)
|
||||||
if process.returncode != 0:
|
print("Script Output:", result.stdout)
|
||||||
log.error(f"Error: {error.decode('utf-8')}")
|
return result.returncode
|
||||||
sys.exit(1)
|
except subprocess.CalledProcessError as e:
|
||||||
return output.decode("utf-8")
|
print("Error running script:", e)
|
||||||
|
print("Error output:", e.stderr)
|
||||||
|
return e.returncode
|
||||||
|
# process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
# output, error = process.communicate()
|
||||||
|
# if process.returncode != 0:
|
||||||
|
# log.error(f"Error: {error.decode('utf-8')}")
|
||||||
|
# sys.exit(1)
|
||||||
|
# return output.decode("utf-8")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue