Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Echo Without Newline Causes Offset #8

Open
deckar01 opened this issue Nov 22, 2017 · 1 comment
Open

Echo Without Newline Causes Offset #8

deckar01 opened this issue Nov 22, 2017 · 1 comment

Comments

@deckar01
Copy link

echo -n seem to cause an off by one issue.

# test.sh

for x in {1,2,3}; do
  echo -n " * Sleeping ${x}s... "
  sleep $x
  echo "Done!"
done
jared@jared-slate:~/src/equity_web> ./test.sh | gnomon
   2.6452s    * Sleeping 1s... Done!
   3.0025s    * Sleeping 2s... Done!
   0.0046s    * Sleeping 3s... Done!
   0.0005s   
             
     Total   5.6534s
@deckar01
Copy link
Author

Avoiding the delayed output fixes the problem, but this is a common strategy used by unit test reporters.

# test.sh

for x in {1,2,3}; do
  echo " * Sleeping ${x}s..."
  sleep $x
done
jared@jared-slate:~/src/equity_web> ./test.sh | gnomon
   0.6463s    * Sleeping 1s...
   2.0020s    * Sleeping 2s...
   3.0065s    * Sleeping 3s...
   0.0005s   
             
     Total   5.6558s

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant