Skip to content

Commit 982c812

Browse files
committed
Read directly from stdin
1 parent c1908c7 commit 982c812

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎cmd/ethtest/main.go‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ package main
2424
import (
2525
"bytes"
2626
"encoding/json"
27+
"io"
2728
"io/ioutil"
2829
"log"
2930
"os"
30-
"strings"
3131

3232
"github.com/ethereum/go-ethereum/ethdb"
3333
"github.com/ethereum/go-ethereum/ethutil"
@@ -65,10 +65,10 @@ type VmTest struct {
6565
Pre map[string]Account
6666
}
6767

68-
func RunVmTest(js string) (failed int) {
68+
func RunVmTest(r io.Reader) (failed int) {
6969
tests := make(map[string]VmTest)
7070

71-
data, _ := ioutil.ReadAll(strings.NewReader(js))
71+
data, _ := ioutil.ReadAll(r)
7272
err := json.Unmarshal(data, &tests)
7373
if err != nil {
7474
log.Fatalln(err)
@@ -125,9 +125,6 @@ func RunVmTest(js string) (failed int) {
125125

126126
func main() {
127127
helper.Logger.SetLogLevel(5)
128-
if len(os.Args) == 1 {
129-
log.Fatalln("no json supplied")
130-
}
131128

132-
os.Exit(RunVmTest(os.Args[1]))
129+
os.Exit(RunVmTest(os.Stdin))
133130
}

0 commit comments

Comments
 (0)