0

I have a ruby script that runs many external executables (.exe). I run these executables in two different ways.

  1. sytem(program)
  2. IO.popen(program), in this case I need the PID since later on I monitor this process.

My UI is designed with FX ruby. When I run the program through my cmd console (ruby MyScript.rb) everything works fine and I don't see any pop-up.

Then, I generate an exe with the OCRA gem by using the following syntax: ocra MyScript.rb --gem-all --windows

The exe is generated correctly; however, when I run any external program, through system or popen, there is a cmd window popping up during the time the exe is running.

Is there a way to hide these cmd windows?

MrBogus
  • 26
  • 1
  • Can you post an example of how you run these executables? E.g. `system 'some argument here'` – engineersmnky Dec 08 '21 at 03:52
  • Hi @engineersmnky, Sure, when using "system" I do something like this: 'cmdTitle = "7Zip" pathProgParm = "c:\\Program Files\\7-Zip\\7zFM.exe" cmdFn = "start " + "\""+ cmdTitle + "\" " + pathProgParm system(#{cmdFn})' When using a pipe I do something like this: 'pathProgParm = "c:\\Program Files\\7-Zip\\7z.exe -h" pipe = IO.popen(pathProgParm)' Once I've generated the exe through OCRA, I see a DOS box displayed while the other executables are running. Once the process is completed the DOS box is automatically closed. – MrBogus Dec 08 '21 at 16:47

0 Answers0