summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2021-12-16 15:00:55 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2021-12-18 10:14:07 +0200
commitea5bb8b47dce95aa98f47d13ada8297670559c8b (patch)
tree17868fd701035115690b9d751a47da7858b9870f /doc/classes
parentb0e93711b36bae3d2bb3a7e9a4a88faf055499fb (diff)
[Windows] Improve console handling and execute/create_process.
Always build with the GUI subsystem. Redirect stdout and stderr output to the parent process console. Use CreateProcessW for blocking `execute` calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with `create_process`). Add `open_console` argument to the `execute` and `create_process` to open a new console window. Remove `interface/editor/hide_console_window` editor setting. Remove `Toggle System Console` menu option. Remove `set_console_visible` and `is_console_visible` functions.
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/DisplayServer.xml29
-rw-r--r--doc/classes/OS.xml6
2 files changed, 13 insertions, 22 deletions
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index 1ca69057b4..4d7b921d96 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -35,12 +35,6 @@
[b]Note:[/b] This method is only implemented on Linux.
</description>
</method>
- <method name="console_set_visible">
- <return type="void" />
- <argument index="0" name="console_visible" type="bool" />
- <description>
- </description>
- </method>
<method name="create_sub_window">
<return type="int" />
<argument index="0" name="mode" type="int" enum="DisplayServer.WindowMode" />
@@ -281,11 +275,6 @@
<description>
</description>
</method>
- <method name="is_console_visible" qualifiers="const">
- <return type="bool" />
- <description>
- </description>
- </method>
<method name="keyboard_get_current_layout" qualifiers="const">
<return type="int" />
<description>
@@ -803,23 +792,21 @@
</constant>
<constant name="FEATURE_NATIVE_DIALOG" value="9" enum="Feature">
</constant>
- <constant name="FEATURE_CONSOLE_WINDOW" value="10" enum="Feature">
- </constant>
- <constant name="FEATURE_IME" value="11" enum="Feature">
+ <constant name="FEATURE_IME" value="10" enum="Feature">
</constant>
- <constant name="FEATURE_WINDOW_TRANSPARENCY" value="12" enum="Feature">
+ <constant name="FEATURE_WINDOW_TRANSPARENCY" value="11" enum="Feature">
</constant>
- <constant name="FEATURE_HIDPI" value="13" enum="Feature">
+ <constant name="FEATURE_HIDPI" value="12" enum="Feature">
</constant>
- <constant name="FEATURE_ICON" value="14" enum="Feature">
+ <constant name="FEATURE_ICON" value="13" enum="Feature">
</constant>
- <constant name="FEATURE_NATIVE_ICON" value="15" enum="Feature">
+ <constant name="FEATURE_NATIVE_ICON" value="14" enum="Feature">
</constant>
- <constant name="FEATURE_ORIENTATION" value="16" enum="Feature">
+ <constant name="FEATURE_ORIENTATION" value="15" enum="Feature">
</constant>
- <constant name="FEATURE_SWAP_BUFFERS" value="17" enum="Feature">
+ <constant name="FEATURE_SWAP_BUFFERS" value="16" enum="Feature">
</constant>
- <constant name="FEATURE_CLIPBOARD_PRIMARY" value="19" enum="Feature">
+ <constant name="FEATURE_CLIPBOARD_PRIMARY" value="18" enum="Feature">
</constant>
<constant name="MOUSE_MODE_VISIBLE" value="0" enum="MouseMode">
Makes the mouse cursor visible if it is hidden.
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index ffc02f09a9..2be8b36822 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -51,8 +51,10 @@
<return type="int" />
<argument index="0" name="path" type="String" />
<argument index="1" name="arguments" type="PackedStringArray" />
+ <argument index="2" name="open_console" type="bool" default="false" />
<description>
Creates a new process that runs independently of Godot. It will not terminate if Godot terminates. The path specified in [code]path[/code] must exist and be executable file or macOS .app bundle. Platform path resolution will be used. The [code]arguments[/code] are used in the given order and separated by a space.
+ On Windows, if [code]open_console[/code] is [code]true[/code] and process is console app, new terminal window will be opened, it's ignored on other platforms.
If the process creation succeeds, the method will return the new process ID, which you can use to monitor the process (and potentially terminate it with [method kill]). If the process creation fails, the method will return [code]-1[/code].
For example, running another instance of the project:
[codeblocks]
@@ -109,8 +111,10 @@
<argument index="1" name="arguments" type="PackedStringArray" />
<argument index="2" name="output" type="Array" default="[]" />
<argument index="3" name="read_stderr" type="bool" default="false" />
+ <argument index="4" name="open_console" type="bool" default="false" />
<description>
Executes a command. The file specified in [code]path[/code] must exist and be executable. Platform path resolution will be used. The [code]arguments[/code] are used in the given order and separated by a space. If an [code]output[/code] [Array] is provided, the complete shell output of the process will be appended as a single [String] element in [code]output[/code]. If [code]read_stderr[/code] is [code]true[/code], the output to the standard error stream will be included too.
+ On Windows, if [code]open_console[/code] is [code]true[/code] and process is console app, new terminal window will be opened, it's ignored on other platforms.
If the command is successfully executed, the method will return the exit code of the command, or [code]-1[/code] if it fails.
[b]Note:[/b] The Godot thread will pause its execution until the executed command terminates. Use [Thread] to create a separate thread that will not pause the Godot thread, or use [method create_process] to create a completely independent process.
For example, to retrieve a list of the working directory's contents:
@@ -124,7 +128,7 @@
int exitCode = OS.Execute("ls", new string[] {"-l", "/tmp"}, output);
[/csharp]
[/codeblocks]
- To execute a composite command, a platform-specific shell can be invoked. For example:
+ If you wish to access a shell built-in or perform a composite command, a platform-specific shell can be invoked. For example:
[codeblocks]
[gdscript]
var output = []