From 9c81387befa18a686b262482cd1dd27b75fe8422 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 28 Oct 2019 06:55:20 -0700 Subject: [PATCH] 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. --- 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)