Shortest pristine truth machine
Rust, 109 106 bytes

fn t(n:i8)-&gt;Result&lt;Box::&lt;Iterator::&lt;Item=i8&gt;&gt;,i8&gt;{if n==0{Err(0)}else{Ok(Box::new(std::iter::repeat(1)))}}

Try it online!
Returns a result whose ok variant is a dynamically typed iterator that always yields one wrapped in a smart pointer so the compiler can know its size. The error variant is simply zero. The code does emit a deprecation warning, so it may randomly stop working at some point in the future. Rust's type inference is too good for me to get a pristine closure, and as verbose as this solution is it is still shorting than fully listing the returned iterator's type and much shorter than using the main function and reading from stdin.
-3 bytes because there is a method to create an endlessly repeating iterator