sindresorhus / fast-cli

Test your download and upload speed using fast.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redirect output is broken

capedra opened this issue · comments

Since this option does not work for me, because it still prints several lines on my output, this is what I did for Cron to work fine running this Bash script:

#!/bin/sh
speedtest=$(/usr/local/bin/node /usr/local/lib/node_modules/fast-cli/cli.js --single-line -u | tail -n 1 | awk '{ print substr( $0, 17 ) }')
result=$(date +'%d/%m/%Y %T ')$(echo $speedtest)
echo $result >> speedtest.txt

Can you show an example of where it prints more than a single line? If it does, it's a bug.

@sindresorhus
Hello Sindre. Sorry about my delay. The issue consists when you output the response of the command to some file. On the terminal you can see one line only, but when you redirect the output to the txt file, you can see several blank lines, white spaces, carriage returns and line breaks.
Anyway, I did this Bash script to include the current date/time and only the last line (the one that matters) of the fast-cli command, eliminating all these unnecessary characters.
I'm attaching the output file of the bash script above that I developed: speedtest.txt
Thank you very much and keep improving this project since it works a lot better than the speedtest-cli!!!

Seems like we broke redirected output in 08b3cf7.