Skip to content

Commit b0f78ea

Browse files
committed
Fix progress bar issues on windows
1 parent 2feaab2 commit b0f78ea

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
scala-blockchain-import*
1515
scala-blockchain-downloader*
1616

17+
blockchain.raw
18+
main
19+
1720
bin/
1821

1922
# Dependency directories (remove the comment below to include it)

src/ipfs/root.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,25 @@ import (
66
"time"
77
"io"
88
"io/ioutil"
9-
//"log"
109
"os/exec"
1110
"os"
1211
"path/filepath"
1312
"bufio"
1413
"bytes"
15-
//"strings"
16-
//"sync"
17-
//"net"
14+
1815

1916
config "github.com/ipfs/go-ipfs-config"
2017
files "github.com/ipfs/go-ipfs-files"
2118
libp2p "github.com/ipfs/go-ipfs/core/node/libp2p"
2219
icore "github.com/ipfs/interface-go-ipfs-core"
2320
icorepath "github.com/ipfs/interface-go-ipfs-core/path"
24-
//peerstore "github.com/libp2p/go-libp2p-peerstore"
25-
//ma "github.com/multiformats/go-multiaddr"
2621

2722
"github.com/ipfs/go-ipfs/core"
2823
"github.com/ipfs/go-ipfs/core/coreapi"
2924
"github.com/ipfs/go-ipfs/plugin/loader"
3025
"github.com/ipfs/go-ipfs/repo/fsrepo"
3126
"github.com/TwinProduction/go-color"
3227
"github.com/cheggaaa/pb/v3"
33-
//"github.com/libp2p/go-libp2p-core/peer"
3428
)
3529

3630
type path struct {
@@ -117,7 +111,8 @@ func spawnEphemeral(ctx context.Context) (icore.CoreAPI, error) {
117111
return createNode(ctx, repoPath)
118112
}
119113

120-
func printDownloadedSize(totalSize int) (err error){
114+
func printDownloadedSize(totalSize int){
115+
121116
bar := pb.New(totalSize)
122117
bar.Set(pb.Bytes, true)
123118
bar.Set(pb.SIBytesPrefix, true)
@@ -129,7 +124,7 @@ func printDownloadedSize(totalSize int) (err error){
129124
for {
130125
fi, err := os.Stat("blockchain.raw")
131126
if err != nil {
132-
return err
127+
continue
133128
}
134129
size := fi.Size()
135130

@@ -150,7 +145,6 @@ func printDownloadedSize(totalSize int) (err error){
150145
break
151146
}
152147
}
153-
return nil
154148
}
155149

156150
func DownloadChain(hash string, importToolPath string, dataDir string, downloadOnly bool, importVerify bool, force bool) {

0 commit comments

Comments
 (0)