Forum: JRuby Cannot get backtick to work on Windows

Posted by Thibaut Barrère (thbar)
on 2010-03-01 11:21
(Received via mailing list)
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
Posted by Vladimir Sizikov (Guest)
on 2010-03-01 11:31
(Received via mailing list)
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
<thibaut.barrere@gmail.com> 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
Posted by Thibaut Barrère (thbar)
on 2010-03-01 15:24
(Received via mailing list)
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(TM) 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
Posted by Roger Pack (rogerdpack)
on 2010-03-02 18:17
> 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(TM) Client VM 1.6.0_17) [x86-java]
Posted by Charles Nutter (headius)
on 2010-03-02 19:08
(Received via mailing list)
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 Pack <lists@ruby-forum.com> 
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
Posted by Thibaut Barrère (thbar)
on 2010-03-02 22:41
(Received via mailing list)
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
Posted by Thibaut Barrère (thbar)
on 2010-03-03 08:54
(Received via mailing list)
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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.