mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 03:38:03 +01:00
Do not choke on missing ENV vars
This commit is contained in:
@@ -8,9 +8,9 @@ class Asciicast(object):
|
||||
def __init__(self, env=os.environ):
|
||||
self.command = None
|
||||
self.title = None
|
||||
self.shell = env['SHELL']
|
||||
self.term = env['TERM']
|
||||
self.username = env['USER']
|
||||
self.shell = env.get('SHELL', '/bin/sh')
|
||||
self.term = env.get('TERM')
|
||||
self.username = env.get('USER')
|
||||
|
||||
@property
|
||||
def meta_data(self):
|
||||
|
||||
@@ -13,7 +13,7 @@ class Recorder(object):
|
||||
|
||||
def record(self, cmd, title):
|
||||
duration, stdout = timer.timeit(self.pty_recorder.record_command,
|
||||
cmd or self.env['SHELL'])
|
||||
cmd or self.env.get('SHELL', '/bin/sh'))
|
||||
|
||||
asciicast = Asciicast()
|
||||
asciicast.title = title
|
||||
|
||||
Reference in New Issue
Block a user