Skip to content

Commit

Permalink
fix: disable download progress logging in non-TTY envs
Browse files Browse the repository at this point in the history
  • Loading branch information
lightpohl committed Jan 22, 2021
1 parent 6263980 commit c0f0dde
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ let getImageUrl = ({ image, itunes }) => {

let BYTES_IN_MB = 1000000;
let printProgress = ({ percent, total, transferred }) => {
if (!process.stdout.isTTY) {
/*
Non-TTY environments do not have access to `stdout.clearLine` and
`stdout.cursorTo`. Skip download progress logging in these environments.
*/
return;
}

let line = "downloading...";
let percentRounded = (percent * 100).toFixed(2);

Expand Down

0 comments on commit c0f0dde

Please sign in to comment.