mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 07:26:47 +00:00
* gct: phase one context awareness pass * exchanges: context propagation pass * common/requester: force context requirement * gctcli/exchanges: linter fix * rpcserver: fix test using dummy rpc server * backtester: fix comments * grpc: add correct cancel and timeout for commands * rpcserver_test: add comment on dummy server * common: deprecated SendHTTPGetRequest * linter: fix * linter: turn on no context check * apichecker: fix context linter issue * binance: use param context * common: remove checks as this gets executed before main * common: change mutex to RW as clients can be used by multiple go routines. * common: remove init and JIT default client. Unexport global variables and add protection. * common: Add comments * bithumb: after dinner mints fix
35 lines
506 B
Go
35 lines
506 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
"runtime"
|
|
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
func clearScreen() error {
|
|
switch runtime.GOOS {
|
|
case "windows":
|
|
cmd := exec.Command("cmd", "/c", "cls")
|
|
cmd.Stdout = os.Stdout
|
|
return cmd.Run()
|
|
default:
|
|
cmd := exec.Command("clear")
|
|
cmd.Stdout = os.Stdout
|
|
return cmd.Run()
|
|
}
|
|
}
|
|
|
|
func closeConn(conn *grpc.ClientConn, cancel context.CancelFunc) {
|
|
err := conn.Close()
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
if cancel != nil {
|
|
cancel()
|
|
}
|
|
}
|