From e0af558c7b67c3a653ebd17d155374c1888b706c Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 26 Oct 2019 18:07:54 -0700 Subject: [PATCH] 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. --- cmd/evm/runner.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go index 3e8ecf6c3c5c..3cbdcad01711 100644 --- a/cmd/evm/runner.go +++ b/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)