ruby - Anything wrong with "throw" inside a PTY.spawn? -


this dev machine , testing purposes. i'm trying start script starts server, ignores once output meets condition. process not end, can't use backticks. -quiting process independently (somewhere else in script). far closest i've got:

require "pty" catch :ready   begin     pty.spawn( "bin/start" ) |stdin, stdout, pid|       begin         stdin.each { |line|           throw(:ready) if line['worker ready']         }       rescue errno::eio         puts "no more output"       end     end   rescue pty::childexited     puts "child process exit"   end end # === end of catch block  # continue rest of script... 

so far works, new ruby , processes. other solutions i've seen online require pipes, forks, , process.detach. doing wrong using throw while in pty.spawn?


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -