Forum: Ruby Rake "sh" does not echo command

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Brock R. (Guest)
on 2008-10-22 18:39
From what I have read, I would expect the ruby/rake "sh" command to echo
the system call to STDOUT - instead just executing it. Is there some
reason why ruby/rake would not be echoing my system commands to my
command window? I am running in Windows. Here is an example:

rule ".#{OBJ_EXT}" => lambda{|objfile| find_source(objfile)} do |t|
    puts "Building object file for #{t.source}"
#{C_TARGET} #{t.source}"

The execution of the above rule never echoes the command following "sh".
Why is that? Is there another shell command I should be using? I realize
that I could just precede everything with a puts of the same line, but
it seems like I am missing something.

Patrick D. (Guest)
on 2008-10-22 19:16
(Received via mailing list)
I always add:

# I like to see the shell commands as they are executed

to my rakefiles.  You can also do things like:

vebose(true) do
  sh this_verbose_command


verbose(false) do
  sh that_quiet_command

The default is not to echo the commands.  My Makefile heritage finds
odd, but now that I've figured out how to get around it, it's not so odd

There might even be a .rakerc file somewhere I could add that to.
if not, then perhaps I have finally come up with an idea that I could
implement and contribute back.

Brock R. (Guest)
on 2008-10-22 19:24
Thanks Patrick.

Patrick D. wrote:
> I always add:
> # I like to see the shell commands as they are executed
> verbose(true)
This topic is locked and can not be replied to.