Forum: JRuby running JRuby scripts from Windows .bat files

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8d042b437b937deb92d0c51515785a19?d=identicon&s=25 Mark Volkmann (mvolkmann)
on 2009-04-30 21:42
(Received via mailing list)
foo.rb contains:
puts "in foo"

foo.bat contains
@echo off
echo hello
jruby foo.rb
echo world

Running "foo" from a Windows command prompt outputs:
hello
in foo

Why doesn't it output "world"? jruby is causing foo.bat to exit before
the last echo runs.

---
Mark Volkmann
http://www.ociweb.com/mark
526d60de6472502bb570a9df2842b33b?d=identicon&s=25 Nick Sieger (Guest)
on 2009-04-30 21:46
(Received via mailing list)
On Thu, Apr 30, 2009 at 2:37 PM, Mark Volkmann <mark@ociweb.com> wrote:
> hello
> in foo
>
> Why doesn't it output "world"? jruby is causing foo.bat to exit before the
> last echo runs.

Seems like the way we wrote jruby.bat is causing it to do that. Try it
with "call jruby foo.rb" instead.

/Nick

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
76aed56df3e087c55e6961f9fca7a6aa?d=identicon&s=25 Michael Campbell (Guest)
on 2009-05-04 15:58
(Received via mailing list)
Mark Volkmann wrote:
> hello
> in foo
>
> Why doesn't it output "world"? jruby is causing foo.bat to exit before
> the last echo runs.

It's a windows batch file ... "feature".   jruby is a batch file too,
and batch files calling other batch files (like you are, there),
TRANSFER control to the called batch file.  They don't call it like a
subroutine or a function and return to the caller.

Like Nick also said, you can do "call jruby foo.rb" which should solve
it for you.

 From windows command prompt, "call /?" will give you a bunch of
information on different things you can do with "call".

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.