-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run built-in commands using OS.execute #26429
Comments
AFAIK removing quotes won't help with internal commands. |
It works as long as we remove the quotes. Consider the following script: func _ready():
var output = []
var res = OS.execute('echo somethingyo', [], true, output)
for o in output:
print(o) Currently we are using argss = "\"\"" + p_path + "\""; which produces
However if I change it to
|
Hah, interesting, blocking/pipe version of
I wonder if it is working at all in exported app or only in editor (which is console application)? Non blocking version uses |
Hm, it does concern me that it wouldn't work with non-blocking option. I suppose we can either:
|
I would assume it should work in an exported app, though I will test it tomorrow. If it doesn't, that's likely a larger concern since it would affect existing expected behavior. |
The quotes should only be added if they are needed. Would that solve the issue? |
Some tests. Non blocking
Blocking version works in exported app, but it's opening new console window each time, even when it's starting GUI app. Also |
Tested in 3.2.4 beta3 and the provided code sample seems to do nothing, not even error appears. |
Sample Project
Godot version:
3.0.6
8d117b2
OS/device including version:
Windows 10 x64
Issue description:
Produces the following:
It appears that the
path
argument is being automatically surrounded in quotes, per OS_Windows::execute.As mentioned in this issue, this can currently be circumvented by calling
CMD /K "<command>"
- however this is not an elegant solution as it requires launching a second process. I propose one of the following solutions which doesn't require this workaround.Solution 1:
Remove automatic quotes. This would have the downside of requiring the user to use quotes
when necessary.
Solution 2:
Enclose the path with quotes only when there is whitespace in the path.
Solution 3:
Check if the command is a DOS command, and enclose the path in quotes if it is not.
The text was updated successfully, but these errors were encountered: