Besi
Besi

Reputation: 22939

Output from ruby command is not shown in STDOUT

I have the following script that outputs the name of a file that is being rendered as I make changes to another file:

jade --watch --pretty index.jade

Since I use this a lot in my project I decided to create a rake task that does this. But when I start the rake task the files get rendered but I no longer see the output.

I am aware that the output is somehow streamed to the STDOUT in this case which seems to behave differently than just executing say an ls command.

This is my Rakefile:

desc 'Watch .jade files'
task :watch do
  puts `jade --watch --pretty index.jade`
end

Upvotes: 1

Views: 190

Answers (1)

gmalette
gmalette

Reputation: 2459

The reason why you're not seeing any output is that jade will block while it's running and only return when you kill it. If you were to kill it, you'd see the puts in effect.

What you want is to use system

system("jade --watch --pretty index.jade")

Which will use your process's STDOUT.

Upvotes: 1

Related Questions