diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lpm.c | 2 | ||||
-rw-r--r-- | src/lpm.lua | 3 |
2 files changed, 3 insertions, 2 deletions
@@ -1138,6 +1138,8 @@ int main(int argc, char* argv[]) { lua_setglobal(L, "VERSION"); lua_pushliteral(L, ARCH_PLATFORM); lua_setglobal(L, "PLATFORM"); + lua_pushboolean(L, isatty(fileno(stdout))); + lua_setglobal(L, "TTY"); #if _WIN32 lua_pushliteral(L, "\\"); #else diff --git a/src/lpm.lua b/src/lpm.lua index c2e829c..9a41848 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1950,7 +1950,7 @@ not commonly used publically. TMPDIR = common.normalize_path(ARGS["tmpdir"]) or CACHEDIR .. PATHSEP .. "tmp" if ARGS["trace"] then system.trace(true) end - if (not JSON and not QUIET) or (JSON and PROGRESS) then + if (not JSON and not QUIET and (TTY or PROGRESS)) or (JSON and PROGRESS) then local start_time, last_read local function format_bytes(bytes) if bytes < 1024 then return string.format("%6d B", math.floor(bytes)) end @@ -1959,7 +1959,6 @@ not commonly used publically. return string.format("%6.2f GB", bytes / (1024*1024*1024)) end if JSON then - write_progress_bar = function(total_read, total_objects_or_content_length, indexed_objects, received_objects, local_objects, local_deltas, indexed_deltas) if type(total_read) == "boolean" then io.stdout:write(json.encode({ progress = { percent = 1, label = progress_bar_label } }) .. "\n") |