Ask politely, first, with SIGINT and SIGQUIT.
18578
def stop(self):
        """"""
        if hasattr(self, 'process'):
            if self.process is not None:
                try:
                    is_running = self.process.poll() is None
                except AttributeError:
                    is_running = False

                if is_running:
                    self.bundle_engine.logline("Stopping {0}".format(self.service.name))
                    self.term_signal_sent = True

                    # Politely ask all child processes to die first
                    try:
                        for childproc in psutil.Process(self.process.pid).children(recursive=True):
                            childproc.send_signal(signal.SIGINT)
                    except psutil.NoSuchProcess:
                        pass
                    except AttributeError:
                        pass

                    try:
                        self.process.send_signal(self.service.stop_signal)
                    except OSError as e:
                        if e.errno == 3:        # No such process
                            pass
                else:
                    self.bundle_engine.warnline("{0} stopped prematurely.".format(self.service.name))
            else:
                self.bundle_engine.warnline("{0} stopped prematurely.".format(self.service.name))
        else:
            self.bundle_engine.warnline("{0} was never successfully started.".format(self.service.name))
1299921
function later (info) {
	process.stdin.resume();
	const action = start.bind(null, info);
	process.on('SIGINT', action);
	process.on('SIGTERM', action);

	(function wait () {
		if (beenthere) {
			return;
		}

		setTimeout(wait, EVENT_LOOP);
	}());
}
721481
def promptyn(msg, default=None):
    
    while True:
        yes = "Y" if default else "y"
        if default or default is None:
            no = "n"
        else:
            no = "N"
        confirm = prompt("%s [%s/%s]" % (msg, yes, no), "").lower()
        if confirm in ("y", "yes"):
            return True
        elif confirm in ("n", "no"):
            return False
        elif not confirm and default is not None:
            return default
1084997
def input(self, more=False):
        """"""
        sys.stdout.flush()
        if more:
            msg = more_prompt
        else:
            msg = main_prompt
        if self.style is not None:
            internal_assert(prompt_toolkit is not None, "without prompt_toolkit cannot highlight style", self.style)
            try:
                return self.prompt(msg)
            except EOFError:
                raise  # issubclass(EOFError, Exception), so we have to do this
            except (Exception, AssertionError):
                logger.display_exc()
                logger.show_sig("Syntax highlighting failed; switching to --style none.")
                self.style = None
        return input(msg)
1258906
def ask_int(msg="Enter an integer", dft=None, vld=None, hlp=None):
    """"""
    vld = vld or [int]
    return ask(msg, dft=dft, vld=vld, fmt=partial(cast, typ=int), hlp=hlp)
216511
def hello():
    "
    click.clear()
    click.secho('Hello World!', fg='green')
    click.secho('Some more text', bg='blue', fg='white')
    click.secho('ATTENTION', blink=True, bold=True)

    click.echo('Continue? [yn] ', nl=False)
    c = click.getchar()
    click.echo()
    if c == 'y':
        click.echo('We will go on')
    elif c == 'n':
        click.echo('Abort!')
    else:
        click.echo('Invalid input :(')
    click.echo_via_pager('\n'.join('Line %d' % idx
                               for idx in range(200)))
919735
def wait_input(self, prompt=''):
        """"""
        self.new_prompt(prompt)
        self.setFocus()
        self.input_mode = True
        self.input_loop = QEventLoop()
        self.input_loop.exec_()
        self.input_loop = None
186778
def confirm_operation(prompt, prefix=None, assume_yes=False, err=False):
    """"""
    if assume_yes:
        return True

    prefix = prefix or click.style(
        "Are you %s certain you want to" % (click.style("absolutely", bold=True))
    )

    prompt = "%(prefix)s %(prompt)s?" % {"prefix": prefix, "prompt": prompt}

    if click.confirm(prompt, err=err):
        return True

    click.echo(err=err)
    click.secho("OK, phew! Close call. :-)", fg="green", err=err)
    return False
953400
public void acceptPrompt() {
        String action = "Clicking 'OK' on a prompt";
        String expected = "Prompt is present to be clicked";
        if (isNotPrompt(action, expected, "click")) {
            return;
        }
        accept(action, expected, "prompt");
    }
210049
function askConfirmation(args) {
  let userAnswer = 'no-answer';
  const merged = merge(DEFAULTS.CONFIRMATIONS, args);
  inquirer.prompt([
    {
      type: DEFAULTS.QUESTION_TYPES.CONFIRM,
      name: 'choice',
      message: merged.question,
      default: merged.defaultValue
    }
  ]).then((answer) => {
    userAnswer = answer.choice;
  });
  while (userAnswer === 'no-answer') {
    wait(100);
  }
  return userAnswer;
}
135377
def prompt(msg, default=None):
    ""
    if default is not None:
        msg = '{} ({})'.format(msg, repr(default))
    msg = '{}: '.format(msg)
    try:
        s = input(msg)
    except KeyboardInterrupt:
        exit(1)
    except EOFError:
        s = ''
    if not s:
        s = default
    return s
1066782
private void signalNotEmpty() {
        final ReentrantLock takeLock = this.takeLock;
        takeLock.lock();
        try {
            notEmpty.signal();
        } finally {
            takeLock.unlock();
        }
    }
249228
def ask_for_password(cls, ui, prompt='Provide your password:', **options):
        
        # optionally set title, that may be used by some helpers like zenity
        return cls.get_appropriate_helper(ui).ask_for_password(prompt,
                                                               title=options.get('title', prompt))
587235
def prompt(*args, **kwargs):
    """"""
    try:
        return click.prompt(*args, **kwargs)
    except click.Abort:
        return False
1175729
async def ask_async(self,
                        patch_stdout: bool = False,
                        kbi_msg: str = DEFAULT_KBI_MESSAGE) -> Any:
        """"""

        if self.should_skip_question:
            return self.default

        try:
            sys.stdout.flush()
            return await self.unsafe_ask_async(patch_stdout)
        except KeyboardInterrupt:
            print("\n{}\n".format(kbi_msg))
            return None
431259
def confirm(prompt=None, resp=False):
    
    if prompt is None:
        prompt = 'Confirm'

    if resp:
        prompt = '%s [%s]|%s: ' % (prompt, 'y', 'n')
    else:
        prompt = '%s [%s]|%s: ' % (prompt, 'n', 'y')

    while True:
        ans = raw_input(prompt)
        if not ans:
            return resp
        if ans not in ['y', 'Y', 'n', 'N']:
            print 'please enter y or n.'
            continue
        if ans == 'y' or ans == 'Y':
            return True
        if ans == 'n' or ans == 'N':
            return False
516774
function Prompt( question, rl, answers ) {

  // Setup instance defaults property
  _.assign( this, {
    height : 0,
    status : "pending"
  });

  // Set defaults prompt options
  this.opt = _.defaults( _.clone(question), {
    validate: function() { return true; },
    filter: function( val ) { return val; },
    when: function() { return true; }
  });

  // Check to make sure prompt requirements are there
  if (!this.opt.message) {
    this.throwParamError("message");
  }
  if (!this.opt.name) {
    this.throwParamError("name");
  }

  // Normalize choices
  if ( _.isArray(this.opt.choices) ) {
    this.opt.choices = new Choices( this.opt.choices, answers );
  }

  this.rl = rl;

  return this;
}