Fix unbzipping of stdout files
This commit is contained in:
parent
df53fa1e2b
commit
e85104179e
@ -40,7 +40,9 @@ class SnapshotWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_timing
|
def get_timing
|
||||||
lines = unbzip(asciicast.stdout_timing.file.read).lines
|
file = asciicast.stdout_timing
|
||||||
|
file.cache_stored_file! unless file.cached?
|
||||||
|
lines = unbzip(file.file.path).lines
|
||||||
|
|
||||||
timing = lines.map do |line|
|
timing = lines.map do |line|
|
||||||
delay, n = line.split
|
delay, n = line.split
|
||||||
@ -51,19 +53,19 @@ class SnapshotWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_stdout
|
def get_stdout
|
||||||
unbzip(asciicast.stdout.file.read)
|
file = asciicast.stdout
|
||||||
|
file.cache_stored_file! unless file.cached?
|
||||||
|
unbzip(file.file.path)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def unbzip(compressed_data)
|
def unbzip(path)
|
||||||
f = IO.popen "bzip2 -d", "r+"
|
f = IO.popen "bzip2 -d -c #{path}", "r"
|
||||||
f.write(compressed_data)
|
data = f.read
|
||||||
f.close_write
|
|
||||||
uncompressed_data = f.read
|
|
||||||
f.close
|
f.close
|
||||||
|
|
||||||
uncompressed_data
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
def log(text, level = :info)
|
def log(text, level = :info)
|
||||||
|
Loading…
Reference in New Issue
Block a user