refactor into new Environment#command_to_s
This commit is contained in:
parent
5fe55a584e
commit
01851c2872
@ -337,11 +337,8 @@ module Rscons
|
|||||||
#
|
#
|
||||||
# @return [true,false,nil] Return value from Kernel.system().
|
# @return [true,false,nil] Return value from Kernel.system().
|
||||||
def execute(short_desc, command, options = {})
|
def execute(short_desc, command, options = {})
|
||||||
print_command = proc do
|
|
||||||
puts command.map { |c| c =~ /\s/ ? "'#{c}'" : c }.join(' ')
|
|
||||||
end
|
|
||||||
if @echo == :command
|
if @echo == :command
|
||||||
print_command.call
|
puts command_to_s(command)
|
||||||
elsif @echo == :short
|
elsif @echo == :short
|
||||||
puts short_desc
|
puts short_desc
|
||||||
end
|
end
|
||||||
@ -350,7 +347,7 @@ module Rscons
|
|||||||
system(*env_args, *Rscons.command_executer, *command, *options_args).tap do |result|
|
system(*env_args, *Rscons.command_executer, *command, *options_args).tap do |result|
|
||||||
unless result or @echo == :command
|
unless result or @echo == :command
|
||||||
$stdout.write "Failed command was: "
|
$stdout.write "Failed command was: "
|
||||||
print_command.call
|
puts command_to_s(command)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -751,6 +748,17 @@ module Rscons
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# Return a string representation of a command.
|
||||||
|
#
|
||||||
|
# @param command [Array<String>]
|
||||||
|
# The command.
|
||||||
|
#
|
||||||
|
# @return [String]
|
||||||
|
# The string representation of the command.
|
||||||
|
def command_to_s(command)
|
||||||
|
command.map { |c| c =~ /\s/ ? "'#{c}'" : c }.join(' ')
|
||||||
|
end
|
||||||
|
|
||||||
# Parse dependencies for a given target from a Makefile.
|
# Parse dependencies for a given target from a Makefile.
|
||||||
#
|
#
|
||||||
# This method is used internally by Rscons builders.
|
# This method is used internally by Rscons builders.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user