def _execute_local(self): """ Run command. """ self._logger.info('executing %s...', self.command) start_time = time.time() # check to make sure command exists if isinstance(self.command, basestring): program_to_execute = self.command else: program_to_execute = self.command[0] command_full_path = find_executable(program_to_execute) if not command_full_path: self.raise_exception( "The command to be executed, '%s', cannot be found" % program_to_execute, ValueError) self._process = \ shellproc.ShellProc(self.command, self.stdin, self.stdout, self.stderr, self.env_vars) self._logger.debug('PID = %d', self._process.pid) try: return_code, error_msg = \ self._process.wait(self.poll_delay, self.timeout) finally: self._process.close_files() self._process = None et = time.time() - start_time if et >= 60: #pragma no cover self._logger.info('elapsed time: %.1f sec.', et) return (return_code, error_msg)
def _execute_local(self): """ Run command. """ self._logger.info('executing %s...', self.command) start_time = time.time() self._process = \ shellproc.ShellProc(self.command, self.stdin, self.stdout, self.stderr, self.env_vars) self._logger.debug('PID = %d', self._process.pid) try: return_code, error_msg = \ self._process.wait(self.poll_delay, self.timeout) finally: self._process.close_files() self._process = None et = time.time() - start_time if et >= 60: #pragma no cover self._logger.info('elapsed time: %.1f sec.', et) return (return_code, error_msg)