diff --git a/cmd/wasmcloud-executor/main.go b/cmd/wasmcloud-executor/main.go index 5bd2217..e7b8775 100644 --- a/cmd/wasmcloud-executor/main.go +++ b/cmd/wasmcloud-executor/main.go @@ -148,6 +148,10 @@ func waitForNewWASM(ctx context.Context, wg *sync.WaitGroup, sh *shell.Shell, nc Name: "logs.txt", Data: logBuf.Bytes(), }, + { + Name: "stdin.txt", + Data: er.Data, + }, { Name: "stdout.txt", Data: stdout.Bytes(), @@ -156,6 +160,7 @@ func waitForNewWASM(ctx context.Context, wg *sync.WaitGroup, sh *shell.Shell, nc Name: "stderr.txt", Data: stderr.Bytes(), }, + result.StatsJSONFile(), result.StatsFile(), { Name: "wasm.cid", diff --git a/cmd/wasmcloud/run.go b/cmd/wasmcloud/run.go index 38598f0..c3c8d01 100644 --- a/cmd/wasmcloud/run.go +++ b/cmd/wasmcloud/run.go @@ -5,6 +5,7 @@ import ( "context" "flag" "fmt" + "io" "io/ioutil" "log" "os" @@ -82,6 +83,7 @@ func (r runCmd) Execute(ctx context.Context, fs *flag.FlagSet, _ ...interface{}) return }) + var stdin bytes.Buffer c := executor.Config{ VMConfig: exec.VMConfig{ GasLimit: r.gasLimit, @@ -93,7 +95,7 @@ func (r runCmd) Execute(ctx context.Context, fs *flag.FlagSet, _ ...interface{}) FuncName: r.funcName, Env: environment, Binary: wasmBin, - Stdin: os.Stdin, + Stdin: io.TeeReader(os.Stdin, &stdin), Stdout: stdout, Stderr: stderr, LogSink: logBuf, @@ -112,6 +114,10 @@ func (r runCmd) Execute(ctx context.Context, fs *flag.FlagSet, _ ...interface{}) Name: "logs.txt", Data: logBuf.Bytes(), }, + { + Name: "stdin.txt", + Data: stdin.Bytes(), + }, { Name: "stdout.txt", Data: stdout.Bytes(), diff --git a/go.mod b/go.mod index ca00ae4..69e8a5c 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/facebookgo/flagenv v0.0.0-20160425205200-fcd59fca7456 github.com/fatih/color v1.7.0 // indirect github.com/go-interpreter/wagon v0.6.0 + github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db github.com/google/subcommands v1.0.1 github.com/google/uuid v1.1.1 github.com/gorilla/mux v1.7.3 diff --git a/go.sum b/go.sum index ddbd66a..b32dab1 100644 --- a/go.sum +++ b/go.sum @@ -106,6 +106,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=