Closed ccmywish closed 1 year ago
If you have a shortcut in Windows that runs rubyw.exe [path to Ruby script]
it won't show a command window and just run the script. OTOH, if the same thing connects to ruby.exe
, it will show a command window briefly.
Hope this helps.
Hi @mohits
Thanks for your information.
Does it run in the background if called with rubyw
?
I didn't come up with any usage scenarios, because I invoke rubyw.exe
in my shell, but it just was over in a flash. I don't get any output back. Could you please help provide some scenarios if you have time?
@mohits the only difference is that no console (cmd.exe) is shown at startup. If you crate ruby application using some GUI gem, then it would work better if you run it via rubyw.exe.
If you run same application via ruby.exe you would get console (cmd.exe) and GUI app. Under rubyw - you will get only GUI app.
This is Windows system limitation - when you create app you must choose should it be console or GUI app. If it is "console app", windows will check if it is run under console command line, if not - windows will provide console and run your app under it.
RubyInstaller provides same Ruby.exe marked compiled as console app, and the RubyW.exe marked and compiled as GUI app.
Console apps support console things - output, piping, textual screen, simple console input, etc ... Windows GUI apps will get started as soon as main "Windows message pump" gets running and return as soon as it stops. This is your rubyw starting "flash" - it is GUI app, but you did not provide any script to actually create Windows GUI, so it returned immediately.
GUIs are their own beasts, and beyond scope of the RubyInstaller. For hands-on experience, try to gem install libui
and create testw.rb from libui homepage
Try running ruby.exe testw.rb
, vs rubyw.exe testw.rb
, try opening testw.rb from explorer (via Open with...)
Wow, very informative and helpful! Thanks @dmajkic and @mohits !
What is
rubyw.exe
?Is it still useful today?