def run_terminal(self, dir_, parameters):
        try:
            if not dir_:
                raise NotFoundError('The file open in the selected view has ' +
                    'not yet been saved')

            pathToProjJson = self.findProjectJsonFile()
            print('path to project.json'+pathToProjJson)

            dir_ = os.path.dirname(self.findProjectJsonFile())

            for k, v in enumerate(parameters):
                parameters[k] = v.replace('%CWD%', dir_)
            args = [KTerminalSelector.get()]
            args.extend(parameters)

            if args[0] == 'gnome-terminal':
                args = shlex.split(args[0] + ' -x bash -ic "' + args[1] + '"')
            elif args[0] in ['terminal', 'konsole', 'xterm']:
                args = shlex.split(args[0] + ' -e bash -ic "' + args[1] + '"')
            elif args[0] == 'xfce4-terminal':
                args = shlex.split(args[0] + ' -H --working-directory=' + dir_ + ' -x ' + args[1])

            encoding = locale.getpreferredencoding(do_setlocale=True)
            if sys.version_info >= (3,):
                cwd = dir_
            else:
                cwd = dir_.encode(encoding)
            print(args)

            if plat == 'win':
                startupinfo = subprocess.STARTUPINFO()
                startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                subprocess.Popen(args, cwd=cwd, startupinfo=startupinfo)
            elif plat == 'linux':
                subprocess.Popen(args, cwd=cwd)
            else:
                subprocess.Popen(args, cwd=cwd)

        except (OSError) as exception:
            print(str(exception))
            sublime.error_message('Terminal: The terminal ' +
                KTerminalSelector.get() + ' was not found')
        except (Exception) as exception:
            sublime.error_message('Terminal: ' + str(exception))
dataset/ETHPy150Open OmniSharp/Kulture/Kulture.py/KTerminalCommand.run_terminal/original