From 48c2864a50012a37950b05063e271b3c5fe83905 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 4 Mar 2012 16:23:47 +0100 Subject: [PATCH] Don't save shell as command if no command specified --- bin/rec.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/rec.py b/bin/rec.py index af7dc4a..9af635c 100755 --- a/bin/rec.py +++ b/bin/rec.py @@ -41,7 +41,8 @@ class AsciiCast(object): def _record(self): os.makedirs(self.path) self.recording_start = time.time() - PtyRecorder(self.path, self.command, self.record_input).run() + command = self.command or os.environ['SHELL'].split() + PtyRecorder(self.path, command, self.record_input).run() self.duration = time.time() - self.recording_start self._save_metadata() @@ -52,7 +53,7 @@ class AsciiCast(object): recorded_at = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(self.recording_start)) - command = ' '.join(self.command) + command = self.command and ' '.join(self.command) uname = self._get_cmd_output(['uname', '-srvp']) shell = os.environ['SHELL'] term = os.environ['TERM'] @@ -353,9 +354,6 @@ def main(): elif len(args) == 1: action = args[0] - command = os.environ['SHELL'].split() - title = None - config = ConfigParser.RawConfigParser() cfg_file = os.path.expanduser('~/.ascii.io/config') try: @@ -376,6 +374,9 @@ def main(): api_url = os.environ.get('ASCII_IO_API_URL', api_url) + command = None + title = None + for opt, arg in opts: if opt in ('-h', '--help'): usage()