mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 19:58: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):
|
def __init__(self, env=os.environ):
|
||||||
self.command = None
|
self.command = None
|
||||||
self.title = None
|
self.title = None
|
||||||
self.shell = env['SHELL']
|
self.shell = env.get('SHELL', '/bin/sh')
|
||||||
self.term = env['TERM']
|
self.term = env.get('TERM')
|
||||||
self.username = env['USER']
|
self.username = env.get('USER')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def meta_data(self):
|
def meta_data(self):
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Recorder(object):
|
|||||||
|
|
||||||
def record(self, cmd, title):
|
def record(self, cmd, title):
|
||||||
duration, stdout = timer.timeit(self.pty_recorder.record_command,
|
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 = Asciicast()
|
||||||
asciicast.title = title
|
asciicast.title = title
|
||||||
|
|||||||
Reference in New Issue
Block a user