0 votes

Some background: I am writing a compiler for a university course, and wanted to create a very simple editor which can compile upon save, and show errors where they occur. I decided to write the editor in Godot, and I need to call my compiler from the editor with the following command:

stack exec compiler-construction-exe material/tests/test.spl

The following code produces a text entry in the output array, which is equal to the text printed to console when I execute "stack" in a command prompt:

var output = []
var pid = OS.execute('stack', [], true, output)

And so does

    var output = []
var pid = OS.execute('stack', ['--version'], true, output)

But, the following command does not produce any output; the output array remains empty:

var output = []
var pid = OS.execute('stack', ['exec'], true, output)

And neither does:

var output = []
var pid = OS.execute('stack exec', [], true, output)

while executing "stack exec" in a command prompt results in an error printed to console:

Missing: CMD

Usage: stack.exe exec CMD [-- ARGS (e.g. stack exec -- ghc-pkg describe base)]
                      ([--plain] | [--[no-]ghc-package-path] [--[no-]stack-exe]
                      [--package ARG] [--rts-options RTSFLAG] [--cwd DIR])
  Execute a command

The full command does not work either.

I'm using Windows 10.
How could this discrepancy be caused? How can I fix it, and get the output data I need?

asked Jun 5, 2019 in Engine by Jan Heemstra (70 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.