better aplay/arecord command logging

This commit is contained in:
Roman Zeyde
2014-07-09 08:36:10 +03:00
parent bd972234fa
commit 613440acf1

View File

@@ -1,6 +1,9 @@
import os
import signal
import subprocess as sp
import logging
log = logging.getLogger(__name__)
from common import Fs
@@ -11,7 +14,7 @@ def record(fname, **kwargs):
return launch('arecord', fname, '-q', '-f', 'S16_LE', '-c', '1', '-r', str(int(Fs)), **kwargs)
def launch(*args, **kwargs):
print args
log.debug('$ %s', ' '.join(args))
p = sp.Popen(args=args, **kwargs)
p.stop = lambda: os.kill(p.pid, signal.SIGINT)
return p