Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self):
self.started_event()
mutex.lock()
log_entry = EventLogModel(category='borg-run',
subcommand=self.cmd[1],
profile=self.params.get('profile_name', None)
)
log_entry.save()
logger.info('Running command %s', ' '.join(self.cmd))
p = Popen(self.cmd, stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True,
env=self.env, cwd=self.cwd, start_new_session=True)
self.process = p
# Prevent blocking of stdout/err. Via https://stackoverflow.com/a/7730201/3983708
os.set_blocking(p.stdout.fileno(), False)
os.set_blocking(p.stderr.fileno(), False)
def read_async(fd):