Skip to content

Commit eda343c

Browse files
committed
Refacot
1 parent f3e79fd commit eda343c

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/core/builtins/job_commands.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,6 @@ fn jobspec_to_array_poss(core: &mut ShellCore, jobspec: &str) -> Vec<usize> {
9898
ans
9999
}
100100

101-
fn get_priority(core: &mut ShellCore, pos: usize) -> usize {
102-
let id = core.job_table[pos].id;
103-
for i in 0..core.job_table_priority.len() {
104-
if core.job_table_priority[i] == id {
105-
return i;
106-
}
107-
}
108-
109-
core.job_table.len()
110-
}
111-
112101
fn print(core: &mut ShellCore, args: &[String]) {
113102
let l_opt = arg::has_option("-l", args);
114103
let r_opt = arg::has_option("-r", args);

src/core/builtins/job_commands/bg.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn bg(core: &mut ShellCore, args: &[String]) -> i32 {
4343
return builtins::error_(0, &args[0], &msg, core);
4444
}
4545

46-
let priority = super::get_priority(core, p);
46+
let priority = get_priority(core, p);
4747
let symbol = match priority {
4848
0 => "+",
4949
1 => "-",
@@ -56,3 +56,14 @@ pub fn bg(core: &mut ShellCore, args: &[String]) -> i32 {
5656
}
5757
0
5858
}
59+
60+
fn get_priority(core: &mut ShellCore, pos: usize) -> usize {
61+
let id = core.job_table[pos].id;
62+
for i in 0..core.job_table_priority.len() {
63+
if core.job_table_priority[i] == id {
64+
return i;
65+
}
66+
}
67+
68+
core.job_table.len()
69+
}

0 commit comments

Comments
 (0)