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?

in Engine by (72 points)

Had a similar problem with git command.

_d = OS.execute('git',[],true,output);

runs fine but

_d = OS.execute('git',['pull'],true,output);


_d = OS.execute('git pull',[],true,output);

both don't work.

I checked the response code _d and it returned 128 when it broke.
Dunno what 128 means though. Nobody ever mentioned it.

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.