{"record":{"id":"76f46dc11db2abd7","repo":"sxyazi/yazi","slug":"process-failed","errorCode":null,"errorMessage":"Process failed","messagePattern":"Process failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-scheduler/src/process/process.rs","lineNumber":79,"sourceCode":"\n\t\tlet mut stdout = BufReader::new(child.stdout.take().unwrap()).lines();\n\t\tlet mut stderr = BufReader::new(child.stderr.take().unwrap()).lines();\n\t\tloop {\n\t\t\tselect! {\n\t\t\t\tOk(Some(line)) = stdout.next_line() => {\n\t\t\t\t\tself.ops.out(id, ProcessOutBg::Log(line));\n\t\t\t\t}\n\t\t\t\tOk(Some(line)) = stderr.next_line() => {\n\t\t\t\t\tself.ops.out(id, ProcessOutBg::Log(line));\n\t\t\t\t}\n\t\t\t\tstatus = child.wait() => {\n\t\t\t\t\tlet status = status.map_err(anyhow::Error::from)?;\n\t\t\t\t\tself.ops.out(id, ProcessOutBg::Log(match status.code() {\n\t\t\t\t\t\tSome(code) => format!(\"Exited with status code: {code}\"),\n\t\t\t\t\t\tNone => \"Process terminated by signal\".to_string(),\n\t\t\t\t\t}));\n\t\t\t\t\tif !status.success() {\n\t\t\t\t\t\tErr(anyhow!(\"Process failed\"))?;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tOk(self.ops.out(id, ProcessOutBg::Succ))\n\t}\n}\n\nimpl Process {\n\t#[inline]\n\tpub(crate) fn submit(&self, r#in: impl Into<ProcessIn>, priority: u8) {\n\t\t_ = self.tx.try_send(r#in.into(), priority);\n\t}\n}\n","sourceCodeStart":61,"sourceCodeEnd":96,"githubUrl":"https://github.com/sxyazi/yazi/blob/a541adde4e5b082719a0f21a87eb3eab071ece58/yazi-scheduler/src/process/process.rs#L61-L96","documentation":"yazi-scheduler's background process runner (`bg`) waits on the spawned child process and, after logging its exit status, checks `status.success()`. A non-zero exit code (or signal termination) makes the task fail with the generic message \"Process failed\" — the real exit code is available in the preceding ProcessOutBg::Log output.","triggerScenarios":"Any shell command dispatched as a background task exits non-zero (e.g. `ExitStatus(code)`), or is killed by a signal (`status.code() == None`).","commonSituations":"User-defined plugin/shell tasks where the command has a bug or bad arguments; commands missing a dependency on the target system; OOM-killer or user Ctrl-C terminating the process by signal.","solutions":["Check the task log output for \"Exited with status code: N\" to see the real code","Run the same command manually in a shell to reproduce and fix the underlying failure","Fix the command's arguments, PATH, or working directory in the task definition","If terminated by signal, investigate why (signal value in the log, dmesg for OOM)"],"exampleFix":"// before\nshell(\"rsync -wrongflag src dst\")\n// after\nshell(\"rsync -av src dst\") // verify flags with `rsync --help` first","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match task_result {\n    Err(e) if e.to_string() == \"Process failed\" => {\n        eprintln!(\"bg task exited non-zero; check ProcessOutBg::Log for the status code\");\n    }\n    other => other,\n}","preventionTips":["Read the task's Log output for \"Exited with status code: N\"","Test commands interactively before registering them as background tasks","Validate command availability on the target machine","Handle signal termination (status.code() == None) explicitly"],"tags":["process","exit-code","background-task"],"backgroundTag":"nonzero-exit-code","analyzedSha":"a541adde4e5b082719a0f21a87eb3eab071ece58","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}