blob: 89b2e640b0eacac529c9b04c7484b51b82d4fef3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use pish::export_fun;
use std::io::{self, IsTerminal};
fn main() {
export_fun::maybe_run_defined_function();
if !io::stdin().is_terminal() {
println!("need to run in a tty");
return;
}
pish::panic::hook();
// it is quite annoying when the terminal window closes due to a crash, so let's just catch all panics
loop {
let res = std::panic::catch_unwind(pish::event_loop);
if res.is_ok() {
break;
}
#[cfg(debug_assertions)]
unsafe {
pish::reload::continue_reload()
}
// prevent incredibly fast panic loops
std::thread::sleep(std::time::Duration::from_secs(1));
}
println!("bye");
}
|