Skip to content

Commit b603eaf

Browse files
committed
Add utility background job test function
1 parent 267b092 commit b603eaf

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

crates/nu-command/src/env/config/config_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub(super) fn start_editor(
106106
let child = ForegroundChild::spawn(
107107
command,
108108
engine_state.is_interactive,
109-
engine_state.current_thread_job.is_some(),
109+
engine_state.is_background_job(),
110110
&engine_state.pipeline_externals_state,
111111
);
112112

crates/nu-command/src/system/run_external.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl Command for External {
251251
let child = ForegroundChild::spawn(
252252
command,
253253
engine_state.is_interactive,
254-
engine_state.current_thread_job.is_some(),
254+
engine_state.is_background_job(),
255255
&engine_state.pipeline_externals_state,
256256
);
257257

crates/nu-protocol/src/engine/engine_state.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,11 @@ impl EngineState {
10721072
.position(|sp| sp == &span)
10731073
.map(SpanId::new)
10741074
}
1075+
1076+
// Determines whether the current state is being held by a background job
1077+
pub fn is_background_job(&self) -> bool {
1078+
self.current_thread_job.is_some()
1079+
}
10751080
}
10761081

10771082
impl GetSpan for &EngineState {

0 commit comments

Comments
 (0)