Skip to content

Commit

Permalink
fix if there are multiple returns from the ls command
Browse files Browse the repository at this point in the history
  • Loading branch information
Divide-By-0 committed Oct 12, 2024
1 parent fd290b6 commit 3a6f3e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/app/modal/compile-circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def main():
def compile_circuit(slug: str):
subprocess.run(["yarn", "install"], check=True, cwd="/project")
ls_result = subprocess.run(["ls /project/circuit/*.circom"], capture_output=True, text=True, check=True, shell=True)
circuitPath = ls_result.stdout.strip()
circuit_files = ls_result.stdout.strip().split('\n')
if len(circuit_files) > 1:
circuitPath = next((file for file in circuit_files if file.endswith(f'/{slug}.circom')), circuit_files[0])
else:
circuitPath = circuit_files[0]
circuitName = circuitPath.split("/")[-1].split(".")[0]
subprocess.run(["mkdir", "-p", f"/temp_output/{slug}"], check=True)
subprocess.run(["circom", circuitPath, "--r1cs", "--wasm", "-o", f"/temp_output/{slug}", "-l", "/project/node_modules"], check=True)
Expand Down

0 comments on commit 3a6f3e4

Please sign in to comment.