Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add quiet/verbose argument to build_vignettes #1543

Closed
flying-sheep opened this issue Jul 18, 2017 · 3 comments
Closed

add quiet/verbose argument to build_vignettes #1543

flying-sheep opened this issue Jul 18, 2017 · 3 comments
Labels
feature a feature request or enhancement

Comments

@flying-sheep
Copy link
Contributor

tools::buildVignettes accepts a quiet = logical(1L) parameter.

for debugging, it would be useful if build_vignettes would accept a parameter like that and pass it to the tools:: function

@hadley
Copy link
Member

hadley commented Aug 1, 2017

Can you confirm that this definitely does what you want? The documentation just says "Weave and run texi2pdf in quiet mode"

@hadley hadley added the feature a feature request or enhancement label Aug 1, 2017
@flying-sheep
Copy link
Contributor Author

yes, it does. texi2dvi (the R function) suppresses all output if quiet = TRUE is supplied

$ R --slave -e 'tools::texi2dvi' | grep -EC3 'quiet|sys2'
function (file, pdf = FALSE, clean = FALSE, quiet = TRUE, texi2dvi = getOption("texi2dvi"), 
    texinputs = NULL, index = TRUE) 
{
    if (clean) 
--
        opt_pdf <- if (pdf) 
            "--pdf"
        else ""
        opt_quiet <- if (quiet) 
            "--quiet"
        else ""
        opt_extra <- ""
        out <- .system_with_capture(texi2dvi, "--help")
--
        env0 <- "LC_COLLATE=C"
        if (grepl(" ", Sys.getenv("TMPDIR"))) 
            env0 <- paste(env0, "TMPDIR=/tmp")
        out <- .system_with_capture(texi2dvi, c(opt_pdf, opt_quiet, 
            opt_extra, shQuote(file)), env = env0)
        log <- paste0(file_path_sans_ext(file), ".log")
        if (out$status && file_test("-f", log) && any(grepl("(Rerun to get|biblatex.*\\\\(re\\\\)run)", 
            readLines(log, warn = FALSE)))) {
            out <- .system_with_capture(texi2dvi, c(opt_pdf, 
                opt_quiet, opt_extra, shQuote(file)), env = env0)
        }
        errors <- character()
        log <- paste0(file_path_sans_ext(file), ".log")
--
            else if (length(out$stderr)) 
                msg <- paste(msg, "Messages:", paste(out$stderr, 
                  collapse = "\\n"), sep = "\\n")
            if (!quiet) 
                msg <- paste(msg, "Output:", paste(out$stdout, 
                  collapse = "\\n"), sep = "\\n")
        }
        do_cleanup(clean)
        if (nzchar(msg)) 
            stop(msg, domain = NA)
        else if (!quiet) 
            message(paste(paste(out$stderr, collapse = "\\n"), 
                paste(out$stdout, collapse = "\\n"), sep = "\\n"))
    }
--
            extra <- paste(extra, paste(paths, collapse = " "))
        }
        base <- basename(file_path_sans_ext(file))
        system(paste(shQuote(texi2dvi), if (quiet) 
            "--quiet"
        else "", if (pdf) 
            "--pdf"
        else "", shQuote(file), extra), intern = TRUE, ignore.stderr = TRUE)
--
            stop(if (pdf) 
                "pdflatex"
            else "latex", " is not available", domain = NA)
        sys2 <- if (quiet) 
            function(...) system2(..., stdout = FALSE, stderr = FALSE)
        else system2
        bibtex <- Sys.getenv("BIBTEX", "bibtex")
        makeindex <- Sys.getenv("MAKEINDEX", "makeindex")
        ltxargs <- c("-interaction=nonstopmode", texfile)
        if (sys2(latex, ltxargs)) 
            stop(gettextf("unable to run '%s' on '%s'", latex, 
                file), domain = NA)
        nmiss <- length(grep("Warning:.*Citation.*undefined", 
            readLines(paste0(base, ".log"))))
        for (iter in 1L:10L) {
            if (nmiss) 
                sys2(bibtex, shQuote(base))
            nmiss_prev <- nmiss
            if (index && file.exists(idxfile)) {
                if (sys2(makeindex, shQuote(idxfile))) 
                  stop(gettextf("unable to run '%s' on '%s'", 
                    makeindex, idxfile), domain = NA)
            }
            if (sys2(latex, ltxargs)) {
                lines <- .get_LaTeX_errors_from_log_file(paste0(base, 
                  ".log"))
                errors <- if (length(lines)) 

@hadley hadley closed this as completed in b7caf0b Aug 2, 2017
@lock
Copy link

lock bot commented Sep 18, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants