From: Joel Pearson Date: 2012-07-21T07:33:03+09:00 Subject: Re: odd "system" command behaviour with CUI and GUI Marvin Gülker wrote in post #1069546: > Am Sat, 21 Jul 2012 04:06:37 +0900 > schrieb Joel Pearson : >> That works with an .rb extension but not .rbw >> Seems to be DOS based commands that aren't working without a console, >> and that extends to cmd itself. >> Interestingly I do get a flicker of a cmd window running that with >> rubyw, but it doesn't hide the file. >> It works if I use command prompt with ruby and run 'rubyw.exe >> test.rbw' from inside the command prompt window. >> >> Joe >> > > It’s been a while since I last did some Windows stuff, but if I > remember correctly, to run any external command you need to attach a > console window to a process. ruby.exe does this by default (resulting > in the CMD popup), and rubyw.exe doesn’t do this (causing no popup). > However, this behaviour is inherited by any child processes, so if you > want to run a command from a process not having a console window > attached, you first have to allocate one using the Win32API and then > attach it to your process. I’ve not done this, but AFAIK it’s possible > with the win32-process gem and its wrapper around the CreateProcess() > Win32API function. > > Valete, > Marvin > > -- > Blog: http://pegasus-alpha.eu/blog > > ASCII-Ribbon-Kampagne () | ASCII Ribbon Campaign () > - Stoppt HTML-E-Mail /\ | - Against HTML E-Mail /\ > - Stoppt proprietäre Anhänge | - Against proprietary attachments > www.asciiribbon.org/index-de.html | www.asciiribbon.org By that point I may as well be using the windows API to hide the file directly :( I'm using OCRA to package this program so that may complicate matters further. Process.detach and Thread.new didn't work properly from an rbw either. -- Posted via http://www.ruby-forum.com/.