mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 17:22:35 +00:00
Hacky fix to reliably get exit status from W3DHub.command on windows
This commit is contained in:
@@ -42,19 +42,25 @@ class W3DHub
|
|||||||
|
|
||||||
def self.command(command, &block)
|
def self.command(command, &block)
|
||||||
if windows?
|
if windows?
|
||||||
stdout_read, stdout_write = IO.pipe
|
stdout_read, stdout_write = IO.pipe if block
|
||||||
|
|
||||||
process_info = Process.create(
|
hash = {
|
||||||
command_line: command,
|
command_line: command,
|
||||||
creation_flags: Process::DETACHED_PROCESS,
|
creation_flags: Process::DETACHED_PROCESS,
|
||||||
process_inherit: true,
|
process_inherit: true,
|
||||||
thread_inherit: true,
|
thread_inherit: true,
|
||||||
inherit: true,
|
close_handles: false,
|
||||||
startup_info: {
|
inherit: true
|
||||||
|
}
|
||||||
|
|
||||||
|
if block
|
||||||
|
hash[:startup_info] = {
|
||||||
stdout: stdout_write,
|
stdout: stdout_write,
|
||||||
stderr: stdout_write
|
stderr: stdout_write
|
||||||
}
|
}
|
||||||
)
|
end
|
||||||
|
|
||||||
|
process_info = Process.create(**hash)
|
||||||
|
|
||||||
pid = process_info.process_id
|
pid = process_info.process_id
|
||||||
status = -1
|
status = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user