當前位置: 首頁>>代碼示例>>Golang>>正文


Golang cmd.RunStdin函數代碼示例

本文整理匯總了Golang中github.com/prasmussen/glot-code-runner/cmd.RunStdin函數的典型用法代碼示例。如果您正苦於以下問題:Golang RunStdin函數的具體用法?Golang RunStdin怎麽用?Golang RunStdin使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了RunStdin函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    fname := filepath.Base(files[0])

    stdout, stderr, err := cmd.Run(workDir, "kotlinc", fname)
    if err != nil {
        return stdout, stderr, err
    }

    return cmd.RunStdin(workDir, stdin, "kotlin", className(fname))
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:11,代碼來源:kotlin.go

示例2: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])

    args := append([]string{"scalac"}, files...)
    stdout, stderr, err := cmd.Run(workDir, args...)
    if err != nil {
        return stdout, stderr, err
    }

    return cmd.RunStdin(workDir, stdin, "scala", "Main")
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:11,代碼來源:scala.go

示例3: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    binName := "a.out"

    stdout, stderr, err := cmd.Run(workDir, "idris", "-o", binName, files[0])
    if err != nil {
        return stdout, stderr, err
    }

    binPath := filepath.Join(workDir, binName)
    return cmd.RunStdin(workDir, stdin, binPath)
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:12,代碼來源:idris.go

示例4: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    binName := "a.out"

    sourceFiles := util.FilterByExtension(files, "cpp")
    args := append([]string{"clang++", "-std=c++11", "-o", binName}, sourceFiles...)
    stdout, stderr, err := cmd.Run(workDir, args...)
    if err != nil {
        return stdout, stderr, err
    }

    binPath := filepath.Join(workDir, binName)
    return cmd.RunStdin(workDir, stdin, binPath)
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:14,代碼來源:cpp.go

示例5: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    binName := "a.exe"

    sourceFiles := reverse(util.FilterByExtension(files, "fs"))
    args := append([]string{"fsharpc", "--out:" + binName}, sourceFiles...)
    stdout, stderr, err := cmd.Run(workDir, args...)
    if err != nil {
        return stdout, stderr, err
    }

    binPath := filepath.Join(workDir, binName)
    return cmd.RunStdin(workDir, stdin, "mono", binPath)
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:14,代碼來源:fsharp.go

示例6: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])

    // Compile all files except the first
    for _, file := range files[1:] {
        stdout, stderr, err := cmd.Run(workDir, "erlc", file)
        if err != nil {
            return stdout, stderr, err
        }
    }

    // Run first file with escript
    return cmd.RunStdin(workDir, stdin, "escript", files[0])
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:14,代碼來源:erlang.go

示例7: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    jsName := "a.js"

    // Find all typescript files and build compile command
    sourceFiles := util.FilterByExtension(files, "ts")
    args := append([]string{"tsc", "-out", jsName}, sourceFiles...)

    // Compile to javascript
    stdout, stderr, err := cmd.Run(workDir, args...)
    if err != nil {
        return stdout, stderr, err
    }

    return cmd.RunStdin(workDir, stdin, "node", jsName)
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:16,代碼來源:typescript.go

示例8: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])

    // Move bootstrap files into work dir
    stdout, stderr, err := cmd.RunBash(workDir, "cp -rf /bootstrap/* .")
    if err != nil {
        return stdout, stderr, err
    }

    // Compile elm to javascript
    stdout, stderr, err = cmd.Run(workDir, "elm-make", files[0], "--output", "elm.js")
    if err != nil {
        return stdout, stderr, err
    }

    // Run javascript with node via app.js from bootstrap
    return cmd.RunStdin(workDir, stdin, "node", "app.js")
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:18,代碼來源:elm.go

示例9: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    objName := "a.o"
    binName := "a.out"

    stdout, stderr, err := cmd.Run(workDir, "nasm", "-f", "elf64", "-o", objName, files[0])
    if err != nil {
        return stdout, stderr, err
    }

    stdout, stderr, err = cmd.Run(workDir, "ld", "-o", binName, objName)
    if err != nil {
        return stdout, stderr, err
    }

    binPath := filepath.Join(workDir, binName)
    return cmd.RunStdin(workDir, stdin, binPath)
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:18,代碼來源:assembly.go

示例10: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    sourceFiles := util.FilterByExtension(files, "ex")
    args := append([]string{"elixirc"}, sourceFiles...)
    return cmd.RunStdin(workDir, stdin, args...)
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:6,代碼來源:elixir.go

示例11: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    return cmd.RunStdin(workDir, stdin, "ruby", files[0])
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:4,代碼來源:ruby.go

示例12: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    return cmd.RunStdin(workDir, stdin, "nim", "--hints:off", "--verbosity:0", "compile", "--run", files[0])
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:4,代碼來源:nim.go

示例13: Run

func Run(files []string, stdin string) (string, string, error) {
    workDir := filepath.Dir(files[0])
    return cmd.RunStdin(workDir, stdin, "java", "-cp", "/usr/share/java/clojure.jar", "clojure.main", files[0])
}
開發者ID:maddyonline,項目名稱:glot-code-runner,代碼行數:4,代碼來源:clojure.go


注:本文中的github.com/prasmussen/glot-code-runner/cmd.RunStdin函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。