def run(self, file_name=None, action='primary', kill_only=False):
        '''
        @action
          One of: [primary, secondary]

        @kill_only
          If `True`, simply kill any running processes we've started.
        '''
        assert kill_only or file_name, 'wrong call'

        self._cleanup()

        if kill_only:
            self._kill()
            return

        working_dir = None
        try:
            working_dir = os.path.dirname(find_pubspec(file_name))
        except (__HOLE__, AttributeError):
            try:
                if not working_dir:
                    working_dir = os.path.dirname(file_name)
            except TypeError as e:
                _logger.debug('cannot run an unsaved file')
                _logger.debug(e)
                return
            except Exception as e:
                _logger.error('programmer error: this exception needs to be handled')
                _logger.error(e)
                return
        except Exception as e:
            _logger.error('programmer error: this exception needs to be handled')
            _logger.error(e)
            return

        dart_view = DartFile.from_path(file_name)

        if dart_view.is_server_app:
            self.run_server_app(file_name, working_dir, action)
            return

        if dart_view.is_web_app:
            self.run_web_app(dart_view, working_dir, action)
            return

        # TODO: improve detection of runnable file (for example, don't attempt
        # to run a part of a library).
        # At this point, we are looking at a file that either:
        #   - is not a .dart or .html file
        #   - is outside of a pub package
        # As a last resort, try to run the file as a script.
        if action != 'primary' or not dart_view.is_dart_file:
            print("Dart: Cannot determine best action for {}".format(
                  dart_view.path
                  ))
            _logger.debug("cannot determine best run action for %s",
                          dart_view.path)
            return

        self.run_server_app(file_name, working_dir, action)
dataset/ETHPy150Open guillermooo/dart-sublime-bundle/run.py/DartRunFileCommand.run