mirror of
https://github.com/nushell/nushell.git
synced 2025-05-06 07:52:57 +00:00
add a helpful msg to indicate a job has been frozen (#15206)
# Description As stated in the title, when pressing ctrl-z, I sometimes feel confused because I return to the REPL without any message. I don't know if the process has been killed or suspended. This PR aims to add a message to notify the user that the process has been frozen. # User-Facing Changes After pressing `ctrl-z`. A message will be printed in repl.  # Tests + Formatting NaN # After Submitting NaN
This commit is contained in:
parent
0e6e9abc12
commit
7d17c2eb5e
@ -144,6 +144,9 @@ fn unfreeze_job(
|
|||||||
jobs.add_job_with_id(old_id, Job::Frozen(FrozenJob { unfreeze: handle }))
|
jobs.add_job_with_id(old_id, Job::Frozen(FrozenJob { unfreeze: handle }))
|
||||||
.expect("job was supposed to be removed");
|
.expect("job was supposed to be removed");
|
||||||
|
|
||||||
|
if state.is_interactive {
|
||||||
|
println!("\nJob {} is re-frozen", old_id.get());
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,6 +313,7 @@ impl Command for External {
|
|||||||
|
|
||||||
let jobs = engine_state.jobs.clone();
|
let jobs = engine_state.jobs.clone();
|
||||||
let this_job = engine_state.current_thread_job.clone();
|
let this_job = engine_state.current_thread_job.clone();
|
||||||
|
let is_interactive = engine_state.is_interactive;
|
||||||
let child_pid = child.pid();
|
let child_pid = child.pid();
|
||||||
|
|
||||||
// Wrap the output into a `PipelineData::ByteStream`.
|
// Wrap the output into a `PipelineData::ByteStream`.
|
||||||
@ -330,7 +331,10 @@ impl Command for External {
|
|||||||
if let ForegroundWaitStatus::Frozen(unfreeze) = status {
|
if let ForegroundWaitStatus::Frozen(unfreeze) = status {
|
||||||
let mut jobs = jobs.lock().expect("jobs lock is poisoned!");
|
let mut jobs = jobs.lock().expect("jobs lock is poisoned!");
|
||||||
|
|
||||||
jobs.add_job(Job::Frozen(FrozenJob { unfreeze }));
|
let job_id = jobs.add_job(Job::Frozen(FrozenJob { unfreeze }));
|
||||||
|
if is_interactive {
|
||||||
|
println!("\nJob {} is frozen", job_id.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}))),
|
}))),
|
||||||
)?;
|
)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user