Cannot get backtick to work on Windows

Hello,

I spotted a difference between MRI and JRuby while working on windows.
The
following works on MRI, not on JRuby:

wmic PROCESS get Processid,CommandLine

wmic is a built-in Windows tool to achieve all sorts of things, here I
list
running processes.

My belief is that there is some temporary batch file created by wmic -
this
may fail because of that. I will try via popen or something similar and
see
if it works.

I assume nobody really came accross this very specific thing - yet
should I
open an issue ?

– Thibaut

Hi,

This works for me on JRuby 1.4 and 1.5.0.dev just fine.

What kind of error are you seeing?

If you could, please use the very latest dev version and run your
script with the following parameters, it would print out some extra
info:

jruby -J-Djruby.debug.launch=true …

You should see something like this:

ShellLauncher: Trying file C:\Windows\wmic.exe
ShellLauncher: Trying file C:\Windows\wmic.com
ShellLauncher: Trying file C:\Windows\wmic.bat
ShellLauncher: Trying file C:\Windows\wmic.cmd
ShellLauncher: Trying file C:\Windows\System32\Wbem\wmic.exe
ShellLauncher: Got it: C:\Windows\System32\Wbem\wmic.exe
ShellLauncher: Launching directly (no shell)

Thanks,
–Vladimir

On Mon, Mar 1, 2010 at 11:20 AM, Thibaut Barrère
[email protected] wrote:

My belief is that there is some temporary batch file created by wmic - this
may fail because of that. I will try via popen or something similar and see
if it works.

I assume nobody really came accross this very specific thing - yet should I
open an issue ?

– Thibaut


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,

This works for me on JRuby 1.4 and 1.5.0.dev just fine.
What kind of error are you seeing?

I’m using jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3)
(Java
HotSpot™ Client VM 1.6.0_16) [x86-java]�

If I put this in test.rb:

wmic PROCESS get Processid,CommandLine

And launch this:

jruby test.rb

the execution is just paused, like if the process was waiting for
something
to terminate.

I also tried jruby -J-Djruby.debug.launch=true test.rb (but I have
version
1.4.0 and can’t install jruby dev there for the moment, I don’t know if
this
property applies there), same output.

Using IO.popen works though…

I’ll see if I can investigate more later on, my time is pretty
constrained
right now.

– Thibaut

jruby test.rb

the execution is just paused, like if the process was waiting for
something
to terminate.

I get this too (pausing) in jirb (ctrl+c doesn’t even work)

jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-02-24 fcb149b) (Java
HotSpot™ Client VM 1.6.0_17) [x86-java]

Can you guys toss this into a bug? Others have reported that backtick

seems to block or pause as well. Ideally if you can provide a
reproducible case that doesn’t require us to install some weird
program or library, that would be best.

I’ll be able to do that tomorrow.

cheers,

– Thibaut

Can you guys toss this into a bug? Others have reported that backtick
seems to block or pause as well. Ideally if you can provide a
reproducible case that doesn’t require us to install some weird
program or library, that would be best.

On Tue, Mar 2, 2010 at 11:17 AM, Roger P. [email protected]
wrote:

jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-02-24 fcb149b) (Java


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Can you guys toss this into a bug? Others have reported that backtick

seems to block or pause as well. Ideally if you can provide a
reproducible case that doesn’t require us to install some weird
program or library, that would be best.

-> http://jira.codehaus.org/browse/JRUBY-4618

I kept the wmic example - although I didn’t know much about that beast
until
a few days ago, wmic is apparently bundled on most Windows machines
(plus I
have no other example that fail that way handy).

– Thibaut

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs