提交 67ea7e86 编写于 作者: chai2010's avatar chai2010

命令行删除对 clang 依赖

上级 5c625055
......@@ -6,7 +6,6 @@ package main
import (
"fmt"
"os"
"os/exec"
"runtime/debug"
"strings"
"time"
......@@ -58,16 +57,33 @@ func main() {
cli.ShowAppHelpAndExit(c, 0)
}
waApp := app.NewApp(build_Options(c))
data, err := waApp.Run(c.Args().First(), nil)
if len(data) != 0 {
fmt.Print(string(data))
ctx := app.NewApp(build_Options(c))
output, err := ctx.WASM(c.Args().First())
if err != nil {
fmt.Println(err)
os.Exit(1)
}
if errx, ok := err.(*exec.ExitError); ok {
os.Exit(errx.ExitCode())
outfile := "a.out.wat"
if !c.Bool("debug") {
defer os.Remove(outfile)
}
if err = os.WriteFile(outfile, []byte(output), 0666); err != nil {
fmt.Println(err)
os.Exit(1)
}
stdoutStderr, err := app.RunWasm(outfile)
if err != nil {
if len(stdoutStderr) > 0 {
fmt.Println(string(stdoutStderr))
}
fmt.Println(err)
os.Exit(1)
}
if len(stdoutStderr) > 0 {
fmt.Println(string(stdoutStderr))
}
return nil
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册