Преглед на файлове

cmd/evm: remove surrounding whitespace in hex input code (#20211)

This way, the output of `evm compile` can be used directly in `evm
--codefile code.txt run`, without stripping the trailing newline first.
Michael Forney преди 6 години
родител
ревизия
9c81387bef
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      cmd/evm/runner.go

+ 2 - 0
cmd/evm/runner.go

@@ -17,6 +17,7 @@
 package main
 
 import (
+	"bytes"
 	"encoding/json"
 	"fmt"
 	"io/ioutil"
@@ -145,6 +146,7 @@ func runCmd(ctx *cli.Context) error {
 		} else {
 			hexcode = []byte(codeFlag)
 		}
+		hexcode = bytes.TrimSpace(hexcode)
 		if len(hexcode)%2 != 0 {
 			fmt.Printf("Invalid input length for hex data (%d)\n", len(hexcode))
 			os.Exit(1)