forked from extern/nushell
return error when user break sleep by ctrl-c (#10234)
# Description Closes: #10218 I think this is `sleep`'s specific issue, it's because it always return a `Value::nothing` where it's interrupted by `ctrl-c`. To fix the issue, I'd propose to make it returns Err(ShellError) This is how it behaves: ```nushell ❯ sleep 5sec; echo "hello!" ^CError: nu:🐚:sleep_breaked × Sleep is breaked. ❯ sleep 5sec; ^echo "hello!" ^CError: nu:🐚:sleep_breaked × Sleep is breaked. ``` # User-Facing Changes None # Tests + Formatting # After Submitting
This commit is contained in:
parent
5f1e8a6af8
commit
7a728340de
@ -62,7 +62,9 @@ impl Command for Sleep {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if nu_utils::ctrl_c::was_pressed(ctrlc_ref) {
|
if nu_utils::ctrl_c::was_pressed(ctrlc_ref) {
|
||||||
break;
|
return Err(ShellError::InterruptedByUser {
|
||||||
|
span: Some(call.head),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user