<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _on_process_finished(self):
 """ Write the process finished message and emit the `finished` signal. """

        exit_code = self._process.exitCode()
        if self._process.exitStatus() != self._process.NormalExit:
            exit_code = 139
        self._formatter.append_message('\x1b[0m\nProcess finished with exit code %d' % exit_code,
                                       output_format=OutputFormat.CustomFormat)
        self.setReadOnly(True)
        self.process_finished.emit()