Ensure terminal gets released even in case of an exception

openid
Marcin Kulik 11 years ago
parent c8c952f08a
commit 3f879e79da

@ -4,10 +4,11 @@ class SnapshotCreator
terminal = Terminal.new(width, height)
seconds = (duration / 2).to_i
bytes = stdout.bytes_until(seconds)
snapshot = terminal.feed(bytes)
terminal.release
snapshot
terminal.feed(bytes)
ensure
terminal.release
end
end

Loading…
Cancel
Save