mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 20:02:38 +09:00
feature #1303: support for STDIN and STDOUT in downloader.rb
Now the file "-" means standard input/output
This commit is contained in:
1 parent
7ad904bd41
commit
dd22bbb362
1 file changed
+12
-6
@@ -64,11 +64,15 @@ class Stream
|
||||
end
|
||||
|
||||
def open_output_file
|
||||
begin
|
||||
@output_file=File.open(@to, "w")
|
||||
rescue
|
||||
STDERR.puts "Error opening output file '#{@to}"
|
||||
exit(-1)
|
||||
if @to=='-'
|
||||
@output_file=STDOUT
|
||||
else
|
||||
begin
|
||||
@output_file=File.open(@to, "w")
|
||||
rescue
|
||||
STDERR.puts "Error opening output file '#{@to}"
|
||||
exit(-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -175,6 +179,8 @@ class Stream
|
||||
|
||||
begin
|
||||
case @from
|
||||
when '-'
|
||||
io=STDIN
|
||||
when /^https?:\/\//
|
||||
io=wget_downloader(@from)
|
||||
when /^file:\/\/(.*)$/
|
||||
@@ -220,7 +226,7 @@ class Stream
|
||||
|
||||
check_hashes
|
||||
|
||||
postprocess
|
||||
postprocess if @to!='-'
|
||||
end
|
||||
|
||||
def postprocess
|
||||
|
||||
Reference in new issue
Block a user