[Rake-devel] Rake::Win32.rake_system

Jim Weirich jim.weirich at gmail.com
Fri Sep 26 00:18:15 EDT 2008

On Sep 25, 2008, at 11:08 PM, Turpin, Jay wrote:

> All,
> Once we upgraded from rake 0.8.1 to 0.8.3, our builds began to  
> break. I traced the issue down to the tasks which were executing sh  
> commands that had embedded newline characters in them.
> For instance, we will often construct small SQL queries using Ruby  
> and then execute using a command-line SQL tool:
> sh "sqlcmd -E -S localhost -Q \"SET NOCOUNT ON
> EXEC sp_who"
> This syntax used to work fine, but now there has been a change to  
> use Rake::Win32.rake_system() instead of using the system()
> # Run a command line on windows.
> def rake_system(*cmd)
>  if cmd.size == 1
>    system("call #{cmd}")
>  else
>     system(*cmd)
>  end
> end
> I'm not sure why this change was made, but if we can modify it to  
> use this syntax instead, it resolves the issue for us:

The change was made because system commands were not properly  
interpolating environment variable values.  The change was to enable  
the proper semantics when running on windows.

> def rake_system(*cmd)
>  cmd.each do |c|
>    system(c)
>  end
> end

Does this version pass the existing unit tests?

-- Jim Weirich
-- jim.weirich at gmail.com

More information about the Rake-devel mailing list