MCPcopy Create free account
hub / github.com/VSCodeConfigHelper/v4 / task_init

Function task_init

src-tauri/src/gui.rs:209–238  ·  view source on GitHub ↗
(args: TaskInitArgs, window: tauri::Window)

Source from the content-addressed store, hash-verified

207
208#[tauri::command]
209fn task_init(args: TaskInitArgs, window: tauri::Window) -> Vec<&'static str> {
210 trace!("task_init: <- {:?}", args);
211 let t = tasks::list(args);
212 let names = t.iter().map(|t| t.0).collect::<Vec<_>>();
213 std::thread::spawn(move || {
214 for (name, action) in t {
215 info!("正在执行任务 {}...", name);
216 let res = action();
217 let payload = match &res {
218 Ok(_) => TaskFinishResult::Ok { name },
219 Err(e) => TaskFinishResult::Err {
220 name,
221 message: e.to_string(),
222 },
223 };
224 trace!("task_finish: -> {:?}", payload);
225 window.emit("task_finish", payload).unwrap();
226 if let Err(e) = res {
227 if let Some(id) = tasks::statistics::send_error(&e) {
228 window.emit("log_sent", id).unwrap();
229 }
230 break;
231 } else {
232 info!("任务 {} 执行成功。", name);
233 }
234 }
235 });
236 trace!("task_init: -> {:?}", names);
237 names
238}

Callers

nothing calls this directly

Calls 3

listFunction · 0.85
send_errorFunction · 0.85
to_stringMethod · 0.80

Tested by

no test coverage detected