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.
Mark V. (Guest)
on 2009-04-30 23: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 V.
http://www.ociweb.com/mark
Nick S. (Guest)
on 2009-04-30 23:46
(Received via mailing list)
On Thu, Apr 30, 2009 at 2:37 PM, Mark V. <removed_email_address@domain.invalid> 
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
Michael C. (Guest)
on 2009-05-04 17:58
(Received via mailing list)
Mark V. 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.