[MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Louis-Philippe
Hi all,

I'm looking  around MacRuby to find a way to run a subprocess and monitor
it, here is what I tried:

NSTask:

framework "foundation"
task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
p task.isRunning
p task.standardOutput

=> Segmentation fault

Open4:

require 'rubygems'
require 'popen4'
status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
  stdin.puts "a = 1"
  stdin.puts "a == 1"
  stdin.close
  puts "pid: #{pid}"
  puts "stdout: #{stdout.read.strip}"
  puts "stderr: #{stderr.read.strip}"
}
puts "status: #{status.inspect}"
puts "exitstatus: #{status.exitstatus}"

=> 
/Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
`open4:': fork() function is unimplemented on this machine
(NotImplementedError)
from
/Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
`popen4:'
from
/Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
`'

Open3:

require 'open3'
puts "starting..."
Open3.popen3('irb') { |stdin,stdout,stderr|
  stdin.puts "a = 1"
  stdin.puts "a == 1"
  stdin.close

  puts "stdout: #{stdout.read.strip}"
  puts "stderr: #{stderr.read.strip}"
}

=> starting...

So...  NSTask segfaults...  Open4 cannot work because of unimplemented
'fork' in MacRuby and Open3 hangs?
Anybody has an other solution to launch and monitor a subprocess?

Thanks!

L-P
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Matt Aimonetti
NSTask is the way to go, I used it in many cases, including some examples in my 
O'Reilly book:
http://macruby.labs.oreilly.com/ch04.html#_tasks_subprocesses

You can also look at this more complex example:

https://github.com/mattetti/couchdbx-app/tree/master/macruby_version/CouchDBX/

The wrappers might be interesting to look at to see how I'm hiding some of the 
complexity.

- Matt

Sent from my iPhone

On Nov 3, 2010, at 7:31, Louis-Philippe  wrote:

> Hi all,
> 
> I'm looking  around MacRuby to find a way to run a subprocess and monitor it, 
> here is what I tried:
> 
> NSTask:
> 
> framework "foundation"
> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
> p task.isRunning
> p task.standardOutput
> 
> => Segmentation fault
> 
> Open4:
> 
> require 'rubygems'
> require 'popen4'
> status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
>   stdin.puts "a = 1"
>   stdin.puts "a == 1"
>   stdin.close
>   puts "pid: #{pid}"
>   puts "stdout: #{stdout.read.strip}"
>   puts "stderr: #{stderr.read.strip}"
> }
> puts "status: #{status.inspect}"
> puts "exitstatus: #{status.exitstatus}"
> 
> => 
> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
>  `open4:': fork() function is unimplemented on this machine 
> (NotImplementedError)
>   from 
> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
>  `popen4:'
>   from 
> /Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
>  `'
> 
> Open3:
> 
> require 'open3'
> puts "starting..."
> Open3.popen3('irb') { |stdin,stdout,stderr|
>   stdin.puts "a = 1"
>   stdin.puts "a == 1"
>   stdin.close
>   
>   puts "stdout: #{stdout.read.strip}"
>   puts "stderr: #{stderr.read.strip}"
> }
> 
> => starting...
> 
> So...  NSTask segfaults...  Open4 cannot work because of unimplemented 'fork' 
> in MacRuby and Open3 hangs?
> Anybody has an other solution to launch and monitor a subprocess?
> 
> Thanks!
> 
> L-P
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Matt Massicotte
Open3 works correctly for me.  I've had tons of problems in the past using 
Open3 (in ruby) with interactive commands.  I think the problem is that you are 
trying to run irb.  The following works for me.

Open3.popen3('ls') { |stdin,stdout,stderr| puts stdout.readlines }

Backticks work as well, but are not nearly as powerful.

ls_output = `ls -l`

Matt

On Nov 3, 2010, at 7:31 AM, Louis-Philippe wrote:

> Hi all,
> 
> I'm looking  around MacRuby to find a way to run a subprocess and monitor it, 
> here is what I tried:
> 
> NSTask:
> 
> framework "foundation"
> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
> p task.isRunning
> p task.standardOutput
> 
> => Segmentation fault
> 
> Open4:
> 
> require 'rubygems'
> require 'popen4'
> status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
>   stdin.puts "a = 1"
>   stdin.puts "a == 1"
>   stdin.close
>   puts "pid: #{pid}"
>   puts "stdout: #{stdout.read.strip}"
>   puts "stderr: #{stderr.read.strip}"
> }
> puts "status: #{status.inspect}"
> puts "exitstatus: #{status.exitstatus}"
> 
> => 
> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
>  `open4:': fork() function is unimplemented on this machine 
> (NotImplementedError)
>   from 
> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
>  `popen4:'
>   from 
> /Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
>  `'
> 
> Open3:
> 
> require 'open3'
> puts "starting..."
> Open3.popen3('irb') { |stdin,stdout,stderr|
>   stdin.puts "a = 1"
>   stdin.puts "a == 1"
>   stdin.close
>   
>   puts "stdout: #{stdout.read.strip}"
>   puts "stderr: #{stderr.read.strip}"
> }
> 
> => starting...
> 
> So...  NSTask segfaults...  Open4 cannot work because of unimplemented 'fork' 
> in MacRuby and Open3 hangs?
> Anybody has an other solution to launch and monitor a subprocess?
> 
> Thanks!
> 
> L-P
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Rob Gleeson
fork() is not implemented in MacRuby, and I don't think it will be implemented 
anytime in the near future because of 
conflicts with the CoreFoundation framework and the Garbage Collector (as I 
understand it).

The same is true for Objective-C applications.

NSTask is definitely the way to go, but you shouldn't experience a segmentation 
fault. 
Looks like a bug.

Perhaps try macruby-nightly, and if it isn't fixed, open a ticket?

On 3 Nov 2010, at 14:31, Louis-Philippe wrote:

> Hi all,
> 
> I'm looking  around MacRuby to find a way to run a subprocess and monitor it, 
> here is what I tried:
> 
> NSTask:
> 
> framework "foundation"
> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
> p task.isRunning
> p task.standardOutput
> 
> => Segmentation fault
> 
> Open4:
> 
> require 'rubygems'
> require 'popen4'
> status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
>   stdin.puts "a = 1"
>   stdin.puts "a == 1"
>   stdin.close
>   puts "pid: #{pid}"
>   puts "stdout: #{stdout.read.strip}"
>   puts "stderr: #{stderr.read.strip}"
> }
> puts "status: #{status.inspect}"
> puts "exitstatus: #{status.exitstatus}"
> 
> => 
> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
>  `open4:': fork() function is unimplemented on this machine 
> (NotImplementedError)
>   from 
> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
>  `popen4:'
>   from 
> /Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
>  `'
> 
> Open3:
> 
> require 'open3'
> puts "starting..."
> Open3.popen3('irb') { |stdin,stdout,stderr|
>   stdin.puts "a = 1"
>   stdin.puts "a == 1"
>   stdin.close
>   
>   puts "stdout: #{stdout.read.strip}"
>   puts "stderr: #{stderr.read.strip}"
> }
> 
> => starting...
> 
> So...  NSTask segfaults...  Open4 cannot work because of unimplemented 'fork' 
> in MacRuby and Open3 hangs?
> Anybody has an other solution to launch and monitor a subprocess?
> 
> Thanks!
> 
> L-P
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel







___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Matt Massicotte
I respectfully disagree :)

NSTask is a huge pain and will result in dramatically more code in the simple 
cases.  Open3 is much easier to work with, and we can only dream of a solution 
as simple as backticks in Cocoa.  It becomes less of an issue if you are 
executing long-running processes and do not want to block on their completion.

All that said, using the Cocoa implementations is definitely generally 
preferred.  But, if Ruby offers something that Cocoa either doesn't or doesn't 
do well, you should:

- use the one that best fits your problem
- file a bug so the Cocoa version can be improved

Matt

On Nov 3, 2010, at 9:00 AM, Matt Aimonetti wrote:

> NSTask is the way to go, I used it in many cases, including some examples in 
> my O'Reilly book:
> http://macruby.labs.oreilly.com/ch04.html#_tasks_subprocesses
> 
> You can also look at this more complex example:
> 
> https://github.com/mattetti/couchdbx-app/tree/master/macruby_version/CouchDBX/
> 
> The wrappers might be interesting to look at to see how I'm hiding some of 
> the complexity.
> 
> - Matt
> 
> Sent from my iPhone
> 
> On Nov 3, 2010, at 7:31, Louis-Philippe  wrote:
> 
>> Hi all,
>> 
>> I'm looking  around MacRuby to find a way to run a subprocess and monitor 
>> it, here is what I tried:
>> 
>> NSTask:
>> 
>> framework "foundation"
>> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
>> p task.isRunning
>> p task.standardOutput
>> 
>> => Segmentation fault
>> 
>> Open4:
>> 
>> require 'rubygems'
>> require 'popen4'
>> status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
>>  stdin.puts "a = 1"
>>  stdin.puts "a == 1"
>>  stdin.close
>>  puts "pid: #{pid}"
>>  puts "stdout: #{stdout.read.strip}"
>>  puts "stderr: #{stderr.read.strip}"
>> }
>> puts "status: #{status.inspect}"
>> puts "exitstatus: #{status.exitstatus}"
>> 
>> => 
>> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
>>  `open4:': fork() function is unimplemented on this machine 
>> (NotImplementedError)
>>  from 
>> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
>>  `popen4:'
>>  from 
>> /Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
>>  `'
>> 
>> Open3:
>> 
>> require 'open3'
>> puts "starting..."
>> Open3.popen3('irb') { |stdin,stdout,stderr|
>>  stdin.puts "a = 1"
>>  stdin.puts "a == 1"
>>  stdin.close
>> 
>>  puts "stdout: #{stdout.read.strip}"
>>  puts "stderr: #{stderr.read.strip}"
>> }
>> 
>> => starting...
>> 
>> So...  NSTask segfaults...  Open4 cannot work because of unimplemented 
>> 'fork' in MacRuby and Open3 hangs?
>> Anybody has an other solution to launch and monitor a subprocess?
>> 
>> Thanks!
>> 
>> L-P
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Matt Aimonetti
I have to respectfully agree that open3 is easier to use, however it doesn't
offer some of the more advanced features offered by NSTask.

I also found out why you are seeing a segfault, the arguments should be
passed in an array, try:

framework "foundation"
task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:["-l"])
p task.isRunning
p task.standardOutput

# keep the run loop running
NSRunLoop.currentRunLoop.runUntilDate(NSDate.distantFuture)

This code works for me.

- Matt


On Wed, Nov 3, 2010 at 9:12 AM, Matt Massicotte wrote:

> I respectfully disagree :)
>
> NSTask is a huge pain and will result in dramatically more code in the
> simple cases.  Open3 is much easier to work with, and we can only dream of a
> solution as simple as backticks in Cocoa.  It becomes less of an issue if
> you are executing long-running processes and do not want to block on their
> completion.
>
> All that said, using the Cocoa implementations is definitely generally
> preferred.  But, if Ruby offers something that Cocoa either doesn't or
> doesn't do well, you should:
>
> - use the one that best fits your problem
> - file a bug so the Cocoa version can be improved
>
> Matt
>
> On Nov 3, 2010, at 9:00 AM, Matt Aimonetti wrote:
>
> > NSTask is the way to go, I used it in many cases, including some examples
> in my O'Reilly book:
> > http://macruby.labs.oreilly.com/ch04.html#_tasks_subprocesses
> >
> > You can also look at this more complex example:
> >
> >
> https://github.com/mattetti/couchdbx-app/tree/master/macruby_version/CouchDBX/
> >
> > The wrappers might be interesting to look at to see how I'm hiding some
> of the complexity.
> >
> > - Matt
> >
> > Sent from my iPhone
> >
> > On Nov 3, 2010, at 7:31, Louis-Philippe  wrote:
> >
> >> Hi all,
> >>
> >> I'm looking  around MacRuby to find a way to run a subprocess and
> monitor it, here is what I tried:
> >>
> >> NSTask:
> >>
> >> framework "foundation"
> >> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
> >> p task.isRunning
> >> p task.standardOutput
> >>
> >> => Segmentation fault
> >>
> >> Open4:
> >>
> >> require 'rubygems'
> >> require 'popen4'
> >> status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
> >>  stdin.puts "a = 1"
> >>  stdin.puts "a == 1"
> >>  stdin.close
> >>  puts "pid: #{pid}"
> >>  puts "stdout: #{stdout.read.strip}"
> >>  puts "stderr: #{stderr.read.strip}"
> >> }
> >> puts "status: #{status.inspect}"
> >> puts "exitstatus: #{status.exitstatus}"
> >>
> >> =>
> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
> `open4:': fork() function is unimplemented on this machine
> (NotImplementedError)
> >>  from
> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
> `popen4:'
> >>  from
> /Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
> `'
> >>
> >> Open3:
> >>
> >> require 'open3'
> >> puts "starting..."
> >> Open3.popen3('irb') { |stdin,stdout,stderr|
> >>  stdin.puts "a = 1"
> >>  stdin.puts "a == 1"
> >>  stdin.close
> >>
> >>  puts "stdout: #{stdout.read.strip}"
> >>  puts "stderr: #{stderr.read.strip}"
> >> }
> >>
> >> => starting...
> >>
> >> So...  NSTask segfaults...  Open4 cannot work because of unimplemented
> 'fork' in MacRuby and Open3 hangs?
> >> Anybody has an other solution to launch and monitor a subprocess?
> >>
> >> Thanks!
> >>
> >> L-P
> >> ___
> >> MacRuby-devel mailing list
> >> [email protected]
> >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> > ___
> > MacRuby-devel mailing list
> > [email protected]
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Louis-Philippe
Great!  Thanks all for the answers!

I would have really liked to use backticks or open3, as they are really
easier to use, but what my example didn't show is that my subprocess will be
interactive, so in that case NSTask really seems like the way to go.

For NSTask segfault, you were right, it was only because arguments were
supposed to be an array, now it works!

Feels good to be able to use NSTask from macruby, lots of power in there!


2010/11/3 Matt Aimonetti 

> I have to respectfully agree that open3 is easier to use, however it
> doesn't offer some of the more advanced features offered by NSTask.
>
> I also found out why you are seeing a segfault, the arguments should be
> passed in an array, try:
>
>
> framework "foundation"
> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:["-l"])
> p task.isRunning
> p task.standardOutput
>
> # keep the run loop running
> NSRunLoop.currentRunLoop.runUntilDate(NSDate.distantFuture)
>
> This code works for me.
>
> - Matt
>
>
>
> On Wed, Nov 3, 2010 at 9:12 AM, Matt Massicotte wrote:
>
>> I respectfully disagree :)
>>
>> NSTask is a huge pain and will result in dramatically more code in the
>> simple cases.  Open3 is much easier to work with, and we can only dream of a
>> solution as simple as backticks in Cocoa.  It becomes less of an issue if
>> you are executing long-running processes and do not want to block on their
>> completion.
>>
>> All that said, using the Cocoa implementations is definitely generally
>> preferred.  But, if Ruby offers something that Cocoa either doesn't or
>> doesn't do well, you should:
>>
>> - use the one that best fits your problem
>> - file a bug so the Cocoa version can be improved
>>
>> Matt
>>
>> On Nov 3, 2010, at 9:00 AM, Matt Aimonetti wrote:
>>
>> > NSTask is the way to go, I used it in many cases, including some
>> examples in my O'Reilly book:
>> > http://macruby.labs.oreilly.com/ch04.html#_tasks_subprocesses
>> >
>> > You can also look at this more complex example:
>> >
>> >
>> https://github.com/mattetti/couchdbx-app/tree/master/macruby_version/CouchDBX/
>> >
>> > The wrappers might be interesting to look at to see how I'm hiding some
>> of the complexity.
>> >
>> > - Matt
>> >
>> > Sent from my iPhone
>> >
>> > On Nov 3, 2010, at 7:31, Louis-Philippe  wrote:
>> >
>> >> Hi all,
>> >>
>> >> I'm looking  around MacRuby to find a way to run a subprocess and
>> monitor it, here is what I tried:
>> >>
>> >> NSTask:
>> >>
>> >> framework "foundation"
>> >> task = NSTask.launchedTaskWithLaunchPath("/bin/ls", arguments:"-l")
>> >> p task.isRunning
>> >> p task.standardOutput
>> >>
>> >> => Segmentation fault
>> >>
>> >> Open4:
>> >>
>> >> require 'rubygems'
>> >> require 'popen4'
>> >> status = POpen4::popen4('irb') { |stdout,stderr,stdin,pid|
>> >>  stdin.puts "a = 1"
>> >>  stdin.puts "a == 1"
>> >>  stdin.close
>> >>  puts "pid: #{pid}"
>> >>  puts "stdout: #{stdout.read.strip}"
>> >>  puts "stderr: #{stderr.read.strip}"
>> >> }
>> >> puts "status: #{status.inspect}"
>> >> puts "exitstatus: #{status.exitstatus}"
>> >>
>> >> =>
>> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/open4-1.0.1/lib/open4.rb:15:in
>> `open4:': fork() function is unimplemented on this machine
>> (NotImplementedError)
>> >>  from
>> /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.2/gems/POpen4-0.1.4/lib/popen4.rb:75:in
>> `popen4:'
>> >>  from
>> /Users/lpperron/Documents/lllaptop/git_repos/Redis/testResque/testOpen4.rb:3:in
>> `'
>> >>
>> >> Open3:
>> >>
>> >> require 'open3'
>> >> puts "starting..."
>> >> Open3.popen3('irb') { |stdin,stdout,stderr|
>> >>  stdin.puts "a = 1"
>> >>  stdin.puts "a == 1"
>> >>  stdin.close
>> >>
>> >>  puts "stdout: #{stdout.read.strip}"
>> >>  puts "stderr: #{stderr.read.strip}"
>> >> }
>> >>
>> >> => starting...
>> >>
>> >> So...  NSTask segfaults...  Open4 cannot work because of unimplemented
>> 'fork' in MacRuby and Open3 hangs?
>> >> Anybody has an other solution to launch and monitor a subprocess?
>> >>
>> >> Thanks!
>> >>
>> >> L-P
>> >> ___
>> >> MacRuby-devel mailing list
>> >> [email protected]
>> >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> > ___
>> > MacRuby-devel mailing list
>> > [email protected]
>> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinf

Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Rob Gleeson
I think you should still file a bug report -- MacRuby should never ever 
segfault :)

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Louis-Philippe
Totally agree Rob...  but right now it seems it does segfault on occasions
and I think some serious bugs affecting functionalities and RubySpecs are
still in the bugbase and I wouldn't like to dissolve those priorities with
more exception handling error... I may not understand how important this
segfault may be, so if you think its really worth it I'll let you file it.

2010/11/3 Rob Gleeson 

> I think you should still file a bug report -- MacRuby should never ever
> segfault :)
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Perry E. Metzger
On Wed, 3 Nov 2010 13:46:24 -0400 Louis-Philippe
 wrote:
> Totally agree Rob...  but right now it seems it does segfault on
> occasions and I think some serious bugs affecting functionalities
> and RubySpecs are still in the bugbase and I wouldn't like to
> dissolve those priorities with more exception handling error... I
> may not understand how important this segfault may be, so if you
> think its really worth it I'll let you file it.
> 
> 2010/11/3 Rob Gleeson 
> 
> > I think you should still file a bug report -- MacRuby should
> > never ever segfault :)

Segfaults are *always* something that should be treated as
very high priority. Why? Because they indicate potential mechanisms
for exploitable security bugs. Any time you can make a runtime dump
core, you've probably hit on a path that can be used for shellcode.

You can never really know when someone might use a MacRuby based app
to view malicious content. It is almost impossible to predict in
advance what sorts of APIs such a system might use. Therefore, such
flaws have to be taken quite seriously.

Perry
-- 
Perry E. [email protected]
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Laurent Sansonetti
Hi Louis-Philippe,

MacRuby should never segfault, as others indicated here. Please help us by 
filing a ticket each time you can reproduce a segfault and we will triage / 
duplicate the reports accordingly.

Thanks in advance :)

Laurent

On Nov 3, 2010, at 10:46 AM, Louis-Philippe wrote:

> Totally agree Rob...  but right now it seems it does segfault on occasions 
> and I think some serious bugs affecting functionalities and RubySpecs are 
> still in the bugbase and I wouldn't like to dissolve those priorities with 
> more exception handling error... I may not understand how important this 
> segfault may be, so if you think its really worth it I'll let you file it.
> 
> 2010/11/3 Rob Gleeson 
> I think you should still file a bug report -- MacRuby should never ever 
> segfault :)
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Compiled Ruby files

2010-11-03 Thread Robert Rice
Hi Laurent:

Does macruby_deploy have an option to compile .rb files in subdirectories of 
the Resources directory? For a large project some of us may want to better 
organize our source files.

Thanks,
Bob Rice


On Nov 2, 2010, at 4:25 AM, Laurent Sansonetti wrote:

> Hi Larry,
> 
> Indeed, the Ruby standard library is not entirely compiled, so you will find 
> .rb files if the MacRuby framework is embedded into the application's bundle. 
> We don't compile the whole standard library for historical reasons, as the 
> AOT compiler wasn't stable enough to work on everything, but we may finally 
> turn the switch on in the upcoming release.
> 
> However, your application's code should be compiled, and .rb files should be 
> removed from the .app bundle for you, by macruby_deploy. If you still do find 
> .rb files that belong to your project in the .app bundle, then there is a bug 
> somewhere.
> 
> To confirm, yes it is okay to delete .rb files when there is a .rbo file in 
> the same directory. More generally, MacRuby's #require will always pick .rbo 
> files in priority over .rb files.
> 
> Laurent
> 
> On Nov 1, 2010, at 9:33 PM, Larry Wilson wrote:
> 
>> I've been poking around in the directories of a MacRuby-based app (that has 
>> been compiled via macruby-deploy) in the usr/lib/ruby subdirectories.  Why 
>> is there not an .rbo file for every .rb source file?  
>> 
>> Is it safe to delete the .rb files if there is a .rbo equivalent?
>> 
>> -Larry
>> 
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby with Subprocesses

2010-11-03 Thread Louis-Philippe
Done,
>From now on I will absolutely report any segfault, with pleasure!

2010/11/3 Laurent Sansonetti 

> Hi Louis-Philippe,
>
> MacRuby should never segfault, as others indicated here. Please help us by
> filing a ticket each time you can reproduce a segfault and we will triage /
> duplicate the reports accordingly.
>
> Thanks in advance :)
>
> Laurent
>
> On Nov 3, 2010, at 10:46 AM, Louis-Philippe wrote:
>
> Totally agree Rob...  but right now it seems it does segfault on occasions
> and I think some serious bugs affecting functionalities and RubySpecs are
> still in the bugbase and I wouldn't like to dissolve those priorities with
> more exception handling error... I may not understand how important this
> segfault may be, so if you think its really worth it I'll let you file it.
>
> 2010/11/3 Rob Gleeson 
>
>> I think you should still file a bug report -- MacRuby should never ever
>> segfault :)
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Compiled Ruby files

2010-11-03 Thread Laurent Sansonetti
Hi Robert,

At a glance, it will only compile .rb files in the Resources directory itself, 
not subdirectories.

  def compile_files
Dir.glob(File.join(@app_bundle, 'Contents/Resources/*.rb'))
  end

I guess we could change it to

Dir.glob(File.join(@app_bundle, 'Contents/Resources/**/*.rb'))

without breaking anything, and without the need to add an option to the tool.

Laurent

On Nov 3, 2010, at 2:35 PM, Robert Rice wrote:

> Hi Laurent:
> 
> Does macruby_deploy have an option to compile .rb files in subdirectories of 
> the Resources directory? For a large project some of us may want to better 
> organize our source files.
> 
> Thanks,
> Bob Rice
> 
> 
> On Nov 2, 2010, at 4:25 AM, Laurent Sansonetti wrote:
> 
>> Hi Larry,
>> 
>> Indeed, the Ruby standard library is not entirely compiled, so you will find 
>> .rb files if the MacRuby framework is embedded into the application's 
>> bundle. We don't compile the whole standard library for historical reasons, 
>> as the AOT compiler wasn't stable enough to work on everything, but we may 
>> finally turn the switch on in the upcoming release.
>> 
>> However, your application's code should be compiled, and .rb files should be 
>> removed from the .app bundle for you, by macruby_deploy. If you still do 
>> find .rb files that belong to your project in the .app bundle, then there is 
>> a bug somewhere.
>> 
>> To confirm, yes it is okay to delete .rb files when there is a .rbo file in 
>> the same directory. More generally, MacRuby's #require will always pick .rbo 
>> files in priority over .rb files.
>> 
>> Laurent
>> 
>> On Nov 1, 2010, at 9:33 PM, Larry Wilson wrote:
>> 
>>> I've been poking around in the directories of a MacRuby-based app (that has 
>>> been compiled via macruby-deploy) in the usr/lib/ruby subdirectories.  Why 
>>> is there not an .rbo file for every .rb source file?  
>>> 
>>> Is it safe to delete the .rb files if there is a .rbo equivalent?
>>> 
>>> -Larry
>>> 
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel