{"record":{"id":"4706151eac824973","repo":"tonhowtf/omniget","slug":"o-gallery-dl-n-o-abriu-a-sa-da-padr-o","errorCode":null,"errorMessage":"o gallery-dl não abriu a saída padrão","messagePattern":"o gallery-dl não abriu a saída padrão","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/tumblr/gdl.rs","lineNumber":270,"sourceCode":"    }\n    if let Some(c) = cookies {\n        cmd.arg(\"--cookies\").arg(c);\n    }\n    for a in extra {\n        cmd.arg(a);\n    }\n    cmd.arg(url)\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::piped())\n        .stderr(std::process::Stdio::piped());\n\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow!(\"não foi possível iniciar o gallery-dl: {}\", e))?;\n    let mut stdout = child\n        .stdout\n        .take()\n        .ok_or_else(|| anyhow!(\"o gallery-dl não abriu a saída padrão\"))?;\n    let stderr = child.stderr.take();\n\n    let err_task = tokio::spawn(async move {\n        use tokio::io::{AsyncBufReadExt, BufReader};\n        let mut tail = String::new();\n        if let Some(e) = stderr {\n            let mut lines = BufReader::new(e).lines();\n            while let Ok(Some(line)) = lines.next_line().await {\n                if !line.trim().is_empty() {\n                    tail = line;\n                }\n            }\n        }\n        tail\n    });\n\n    super::super::report(progress, id, \"started\", 0, None, None);\n    let mut text = String::new();","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/tumblr/gdl.rs#L252-L288","documentation":"After spawning gallery-dl, dump() takes the piped stdout handle; if it is unexpectedly absent, this error is thrown. Stdout was configured as piped, so a None here is an internal invariant violation meaning the child could not provide the standard output stream.","triggerScenarios":"child.stdout.take() returns None right after spawn despite Stdio::piped() being set — essentially only if the Command was misconfigured before this point or the pipe creation failed at the OS level.","commonSituations":"Very rare; typically indicates library-internal misconfiguration, extreme resource exhaustion (fd limit), or a modified code path where stdout was no longer piped.","solutions":["Check that stdout(Stdio::piped()) is still set on the Command in dump()","Raise the file-descriptor limit (ulimit -n) if the system is exhausting pipes","Retry; if reproducible, report as a bug since piped stdout should always be available"],"exampleFix":"// before\nlet mut child = cmd.spawn().map_err(|e| anyhow!(\"não foi possível iniciar o gallery-dl: {}\", e))?;\nlet mut stdout = child.stdout.take().ok_or_else(|| anyhow!(\"o gallery-dl não abriu a saída padrão\"))?;\n// after\nlet mut child = cmd.stdout(std::process::Stdio::piped()).spawn().map_err(|e| anyhow!(\"spawn falhou: {}\", e))?;\nlet Some(mut stdout) = child.stdout.take() else {\n    anyhow::bail!(\"o gallery-dl não abriu a saída padrão (stdout não estava piped)\");\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let dump = gdl::dump(&url, cookies, limit).await\n    .map_err(|e| { eprintln!(\"falha no pipe do gallery-dl: {e}\"); e })?;","preventionTips":["Keep stdout(Stdio::piped()) configured on the Command","Avoid running under severely restricted fd limits","Retry once on transient spawn/pipe failures"],"tags":["process-spawn","stdout","invariant","rust"],"backgroundTag":"internal-invariant-violation","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}