Skip to content

Commit b625e2a

Browse files
use run_binary in cairo_program_runner (#300)
## Type - [ ] feature - [ ] bugfix - [ ] dev (no functional changes, no API changes) - [ ] fmt (formatting, renaming) - [ ] build - [ ] docs - [ ] testing ## Description ## Breaking changes? - [ ] yes - [ ] no <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/starkware-libs/proving-utils/300) <!-- Reviewable:end -->
1 parent e16f9d0 commit b625e2a

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

crates/cairo-program-runner/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ thiserror-no-std.workspace = true
2222
regex.workspace = true
2323
num-bigint.workspace = true
2424
cairo-program-runner-lib = { path = "../cairo-program-runner-lib", version = "1.0.0" }
25+
stwo-cairo-utils.workspace = true
2526

2627
[dev-dependencies]
2728
assert_matches = "1.5.0"

crates/cairo-program-runner/src/bin/cairo_program_runner/main.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
use std::env;
2-
use std::error::Error;
3-
use std::io::{self, Write};
4-
use std::path::PathBuf;
5-
61
use bincode::enc::write::Writer;
72
use cairo_program_runner_lib::utils::{
83
get_cairo_run_config, get_program, get_program_input_from_path, write_output_to_file,
94
};
105
use cairo_vm::types::layout_name::LayoutName;
6+
use std::env;
7+
use std::error::Error;
8+
use std::io::{self, Write};
9+
use std::path::PathBuf;
10+
use std::process::ExitCode;
1111

1212
use cairo_program_runner_lib::cairo_run_program;
1313
use cairo_vm::cairo_run;
1414
use cairo_vm::vm::errors::cairo_run_errors::CairoRunError;
1515
use clap::Parser;
16+
use stwo_cairo_utils::binary_utils::run_binary;
1617
use tempfile::NamedTempFile;
1718

1819
fn parse_bool(s: &str) -> Result<bool, String> {
@@ -148,7 +149,11 @@ impl FileWriter {
148149
}
149150
}
150151

151-
fn main() -> Result<(), Box<dyn Error>> {
152+
fn main() -> ExitCode {
153+
run_binary(run, "cairo_program_runner")
154+
}
155+
156+
fn run() -> Result<(), Box<dyn Error>> {
152157
let args = match Args::try_parse_from(env::args()) {
153158
Ok(args) => args,
154159
Err(err) => err.exit(),

0 commit comments

Comments
 (0)