Class: Guard::Dsl
- Inherits:
-
Object
- Object
- Guard::Dsl
- Defined in:
- lib/guard/shell.rb
Instance Method Summary collapse
-
#eager(command) ⇒ Object
Eager prints the result for stdout and stderr as it would be written when running the command from the terminal.
-
#n(msg, title = '', image = nil) ⇒ Object
Easy method to display a notification.
Instance Method Details
#eager(command) ⇒ Object
Eager prints the result for stdout and stderr as it would be written when running the command from the terminal. This is useful for long running tasks.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/guard/shell.rb', line 45 def eager(command) require 'pty' begin PTY.spawn command do |r, w, pid| begin $stdout.puts r.each {|line| print line } rescue Errno::EIO # the process has finished end end rescue PTY::ChildExited $stdout.puts "The child process exited!" end end |
#n(msg, title = '', image = nil) ⇒ Object
Easy method to display a notification
38 39 40 |
# File 'lib/guard/shell.rb', line 38 def n(msg, title='', image=nil) Compat::UI.notify(msg, :title => title, :image => image) end |