kurtlawrence / papyrus

(Rust) repl
MIT License
440 stars 14 forks source link

REPL always print the same result as [out0] #87

Open cmal opened 4 years ago

cmal commented 4 years ago

Hi, I installed papyrus using the follow command on Mac OS X, repl always print the same result as [out0].

$ cargo +stable install papyrus --no-default-features --features="format,runnable"

[lib] papyrus=> 2 + 2 papyrus [out0]: 4 [lib] papyrus=> "xxx" == "xxx" papyrus [out1]: 4 [lib] papyrus=> 1 == 3 papyrus [out2]: 4 [lib] papyrus=> 2 + 3 papyrus [out3]: 4

$ uname -a
Darwin xxx.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64

kurtlawrence commented 4 years ago

Hi @cmal, thanks for the bug report. I am unable to reproduce on Linux or Windows.

What version of Rust are you running?

nclements commented 4 years ago

Hello,

Can't speak for @cmal but I found the same problem. Same version of MacOS, initially using v1.43.1, now using 1.44.1 of Rust.

Whatever is displayed in the first return output is then always displayed for every consecutive test.

$ papyrus
[lib] papyrus=> 2 + 3
papyrus [out0]: 5
[lib] papyrus=> 2 + 2
papyrus [out1]: 5
[lib] papyrus=> 1 + 1
papyrus [out2]: 5
[lib] papyrus=>

Poking around I looked at the ~/.papyrus/src/lib.rs file and it's capturing output as:

#[no_mangle]
pub extern "C" fn _lib_intern_eval() -> kserd::Kserd<'static> {
let out0 = 2 + 3;
let out1 = 2 + 2;
let out2 = 1 + 1;
kserd::ToKserd::into_kserd(out2).unwrap().into_owned()
}
tan-wei commented 3 years ago

Met the same issue. I use MacOS.