Skip to content

Commit 9c81387

Browse files
michaelforneyfjl
authored andcommitted
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.
1 parent 72617a0 commit 9c81387

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎cmd/evm/runner.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package main
1818

1919
import (
20+
"bytes"
2021
"encoding/json"
2122
"fmt"
2223
"io/ioutil"
@@ -145,6 +146,7 @@ func runCmd(ctx *cli.Context) error {
145146
} else {
146147
hexcode = []byte(codeFlag)
147148
}
149+
hexcode = bytes.TrimSpace(hexcode)
148150
if len(hexcode)%2 != 0 {
149151
fmt.Printf("Invalid input length for hex data (%d)\n", len(hexcode))
150152
os.Exit(1)

0 commit comments

Comments
 (0)