Call this function at the end of your class's `__init__` function.

def run(self, cmd=None):
		"""
		Call this function at the end of your class's `__init__` function.
		"""
		diagnostics.prefix.append(self.name)

		if not cmd:
			cmd = self.cmd

		stderr = os.path.abspath(self.name + '.log')
		self.args.append('2>>'+stderr)

		if self.pipe:
			self.args += ('|', self.pipe, '2>>'+stderr)

		# Write to a stdout file if it was set by the derived class.
		# Otherwise, stdout and stderr will be combined into the log file.
		if self.stdout:
			stdout = os.path.abspath(self.stdout)
			self.args.append('1>'+stdout)
			diagnostics.log('stdout', stdout)
		elif self.stdout_append:
			stdout = os.path.abspath(self.stdout_append)
			self.args.append('1>>'+stdout)
			diagnostics.log('stdout', stdout)
		else:
			self.args.append('1>>'+stderr)

		# Print timestamp to log
		open(stderr, 'a').write("[biolite] timestamp=%s\n" % utils.timestamp())
		diagnostics.log('log', stderr)

		cmd = ' '.join(chain(cmd, map(str, self.args)))
		diagnostics.log('command', cmd)

		start = time.time()
		save_cwd = os.getcwd()
		try:
			os.chdir(self.cwd)
			spawn_pid = os.spawnle(os.P_NOWAIT, self.shell, self.shell, '-c', cmd, self.env)
			wait_pid, retcode, rusage = os.wait4(spawn_pid, 0)
			if wait_pid != spawn_pid:
				utils.die("could not wait for process %d: got %d" % (spawn_pid, wait_pid))
			os.chdir(save_cwd)
		except OSError as e:
			utils.info(e)
			utils.die("could not run wrapper for command:\n%s" % cmd)
			#utils.failed_executable(exe, e)

		elapsed = time.time() - start
		retcode = os.WEXITSTATUS(retcode)

		if (self.return_ok is not None) and (self.return_ok != retcode):
			# Give some context to the non-zero return.
			if os.path.isfile(stderr):
				subprocess.call(['tail', '-3', stderr])
			utils.die("non-zero return (%d) from command:\n%s" % (retcode, cmd))

		# Log profile.
		diagnostics.prefix.append('profile')
		diagnostics.log('name', self.name)
		diagnostics.log('return', retcode)
		diagnostics.log('walltime', elapsed)
		diagnostics.log('usertime', rusage.ru_utime)
		diagnostics.log('systime', rusage.ru_stime)
		if config.uname == 'Darwin':
			diagnostics.log('maxrss', rusage.ru_maxrss / 1024)
		else:
			diagnostics.log('maxrss', rusage.ru_maxrss)
		diagnostics.prefix.pop()

		# Reverse any output patterns, since they will be matched against
		# program output from the last line backward.
		if self.output_patterns:
			self.output_patterns.reverse()

		diagnostics.log_program_output(stderr, self.output_patterns)
		diagnostics.prefix.pop()