Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scarb 🔥 #162

Merged
merged 7 commits into from
Nov 4, 2023
Merged

scarb 🔥 #162

merged 7 commits into from
Nov 4, 2023

Conversation

shramee
Copy link
Owner

@shramee shramee commented Oct 30, 2023

No description provided.

@shramee shramee requested a review from enitrat October 30, 2023 18:52
@shramee shramee changed the base branch from fix-cmd-stdout to main October 30, 2023 21:31
Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so good!

Cargo.toml Show resolved Hide resolved
corelib/Scarb.lock Outdated Show resolved Hide resolved
runner-crate/src/lib.cairo Outdated Show resolved Hide resolved
tests/fixture/cairo/runner-crate/src/lib.cairo Outdated Show resolved Hide resolved
@shramee shramee force-pushed the scarb branch 2 times, most recently from 49e7a5b to f094403 Compare October 31, 2023 07:35
@shramee shramee requested a review from enitrat November 3, 2023 09:01
src/scarb.rs Show resolved Hide resolved
Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, smart approach! LGTM, didn't test but if it works lets go :)

@shramee shramee merged commit 2c3b12e into main Nov 4, 2023
1 check passed
@beeinger
Copy link

beeinger commented Nov 20, 2023

@enitrat @shramee
There seems to be a problem, there is no Output whatsoever

use debug::PrintTrait;
'Hello, World!'.print();

does nothing, output is:

Output:
====================

====================

Seems like instead of running programs with scarb, you only compile and the output is always empty

pub fn scarb_build(file_path: &PathBuf) -> anyhow::Result<String> {
    let crate_path = prepare_crate_for_exercise(file_path);
    let config = scarb_config(crate_path);

    match compile(&config, false) {
        // Here it returns an empty string and that's why there is no output
        Ok(_) => Ok("".into()),
        Err(_) => anyhow::bail!("Couldn't build the exercise..."),
    }
}

This starts at:

fn compile_and_run_cairo(exercise: &Exercise) -> Result<String, ()> {

this function only compiles, doesn't run the program
and this is where the empty string comes from:
Ok(_) => Ok("".into()),

@enitrat
Copy link
Collaborator

enitrat commented Nov 20, 2023

Hi @beeinger - thanks for investigating, shramee is on it!

#171 should solve it

@shramee
Copy link
Owner Author

shramee commented Nov 21, 2023

The prints should be above it, output is the output of run function (main()). If your function returns something, it'll be shown here. Runner just prints the messages.

Sorry, this is after #171. You can try that branch.

@beeinger
Copy link

Oh, makes sense!
Already tried that branch, thx, also have a look at this: #171 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants