cmd/evm: Allow surrounding whitespace in codefile

This way, the output of `evm compile` can be used directly in `evm
--codefile code.txt run`, without stripping the trailing newline first.
This commit is contained in:
Michael Forney 2019-10-26 18:07:54 -07:00
parent db79143a13
commit e0af558c7b

View file

@ -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)