enkessler / childprocess

Cross-platform Ruby library for managing child processes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prevent Windows from opening window for child process

jmthomas opened this issue · comments

This was implemented in #73 but not merged due to being Windows specific. I'm adding the issue for future people searching how to do it. If you don't want to be dependent on a forked repository you can add this functionality by overriding setup_flags:

require 'childprocess'

module ChildProcess
  module Windows
    class ProcessBuilder
      private
      # Override setup_flags to add the No Window option so we don't popup a
      # DOS window when we execute a process
      def setup_flags
        @flags |= 0x08000000
      end
    end
  end
end

Closing as informational. Thanks for sharing your workaround!