Closed samaaron closed 4 years ago
Hi @samaaron! I think you can get the results of a single exercise (complete with the stdout) using rustlings run <name_of_exercise>
.
So, for me,
$: rustlings run variables3
Number 3
Number 5
✅ Successfully ran exercises/variables/variables3.rs
I don't know if there's a way to get stdout with rustlings verify
or with rustlings watch
. Maybe getting stdout
while watch is incrementally re-running would be a good feature request!
I am also unable to get the output on rustlings run
. WSL2, fish/bash.
What can I do that might help diagnose this issue?
To add to my previous comment, I tried running different programs that actually have a main function, and most of them work.
Here are the ones that didn't:
as_ref_mut
, from_into
, errors3
, primitive_types1
, traits1
.
Hi @fspy, just because a program file has a main
in it does not mean that the main
function will get invoked. The info.toml
file helps the commands look for programs to compile and run or test. If an exercise has a value of test
for mode in the info.toml
, that means that the program will get compiled and tested only. Its main
function does not get invoked.
But you're probably still wondering why then the println!
lines in the test cases are not showing? That is a valid question, and one whose answer lies within the rustc --test
command that is used by rustlings
to run target tests. We can, relatively easily, add the feature to have rustc --test
generate display the printed stuff to the standard output (or error).
One solution to your problem may be to add a global flag/option to rustlings
called something like --show-output
which should force the run
, verify
and watch
commands to output stuff even when the mode of the target exercise is test
.
Please, everyone, feel free to chime in and let me know what you think.
Thank you!
Abdou
@rrcobb @samaaron forgot to mention you in the comment above
thanks @AbdouSeck, now I can see my logs using rustlings --nocapture watch
Hi there,
I'm working through rustlings on a Windows machine. It's a wonderful resource - thank-you so much for putting the effort into making it.
One thing I have yet to figure out is how to view the output of the current exercise. Currently I just see if an exercise compiles (and the compile errors if not). However, if an exercise uses
println!
it would be lovely to be able to see that output somewhere.Am I doing something wrong or is this something that's yet to be implemented?