Kills somebody.

    Syntax: {command} <victim>
162554
def cmd(send, msg, args):
    
    if not msg:
        send("kill who?")
        return
    if msg.lower() == args['botnick'].lower():
        send('%s is not feeling suicidal right now.' % msg)
    else:
        send('Die, %s!' % msg)
945252
async function kill(pid) {
  try {
    process.kill(pid, 'SIGTERM')
  } catch (err) {
    if (err.code !== 'ESRCH') throw err
  }
}
750993
def die(arg, msg = nil, error_code = nil)
    if msg
      $stderr.puts "Error: argument --#{@specs[arg][:long]} #{msg}."
    else
      $stderr.puts "Error: #{arg}."
    end
    if @educate_on_error
      $stderr.puts
      educate $stderr
    else
      $stderr.puts "Try --help for help."
    end
    exit(error_code || -1)
  end
161808
def kill_process(procname, scriptname):
    """"""

    # from http://stackoverflow.com/a/2940878
    import signal
    import subprocess

    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
    out, err = p.communicate()

    for line in out.decode().splitlines():
        if procname in line and scriptname in line:
            pid = int(line.split()[1])
            info('Stopping %s %s %d' % (procname, scriptname, pid))
            os.kill(pid, signal.SIGKILL)
639957
def kill_process(self, payload):
        """"""
        # Kill specific processes, if `keys` is given in the payload
        kill_signal = signals[payload['signal'].lower()]
        kill_shell = payload.get('all', False)
        if payload.get('keys'):
            succeeded = []
            failed = []
            for key in payload.get('keys'):
                success = self.process_handler.kill_process(key, kill_signal, kill_shell)
                if success:
                    succeeded.append(str(key))
                else:
                    failed.append(str(key))

            message = ''
            if len(succeeded) > 0:
                message += "Signal '{}' sent to processes: {}.".format(payload['signal'], ', '.join(succeeded))
                status = 'success'
            if len(failed) > 0:
                message += '\nNo running process for keys: {}'.format(', '.join(failed))
                status = 'error'

            answer = {'message': message.strip(), 'status': status}

        # Kill all processes and the daemon
        else:
            self.process_handler.kill_all(kill_signal, kill_shell)
            if kill_signal == signal.SIGINT or \
               kill_signal == signal.SIGTERM or \
               kill_signal == signal.SIGKILL:
                self.paused = True
            answer = {'message': 'Signal send to all processes.',
                      'status': 'success'}
        return answer
840635
public void kill() {
        Util.out4.println("In Kill command");
        // call delete_device
        final int nb_class = class_list.size();
        for (int j = 0; j < nb_class; j++) {
            final Vector<?> v = ((DeviceClass) class_list.elementAt(j)).get_device_list();
            final int nb_dev = v.size();
            for (int k = 0; k < nb_dev; k++) {
                final DeviceImpl dev = (DeviceImpl) v.elementAt(k);
                if (dev.get_exported_flag() == true) {
                    try {
                        dev.delete_device();
                    } catch (final DevFailed e) {
                        e.printStackTrace();
                        // ignore error, kill the device anyway
                    }
                }
            }
        }
        //
        // Create the thread and start it
        //
        final KillThread killer = new KillThread();

        killer.start();
    }
10354
def kill(arg1, arg2):
    
    from subprocess import Popen, PIPE

    # Wait until ready
    t0 = time.time()
    # Wait no more than these many seconds
    time_out = 30
    running = True

    while running and time.time() - t0 < time_out:
        if os.name == 'nt':
            p = Popen(
                'tasklist | find "%s"' % arg1,
                shell=True,
                stdin=PIPE,
                stdout=PIPE,
                stderr=PIPE,
                close_fds=False)
        else:
            p = Popen(
                'ps aux | grep %s' % arg1,
                shell=True,
                stdin=PIPE,
                stdout=PIPE,
                stderr=PIPE,
                close_fds=True)

        lines = p.stdout.readlines()

        running = False
        for line in lines:
            # this kills all java.exe and python including self in windows
            if ('%s' % arg2 in line) or (os.name == 'nt'
                                         and '%s' % arg1 in line):
                running = True

                # Get pid
                fields = line.strip().split()

                info('Stopping %s (process number %s)' % (arg1, fields[1]))
                if os.name == 'nt':
                    kill = 'taskkill /F /PID "%s"' % fields[1]
                else:
                    kill = 'kill -9 %s 2> /dev/null' % fields[1]
                os.system(kill)

        # Give it a little more time
        time.sleep(1)
    else:
        pass

    if running:
        raise Exception('Could not stop %s: '
                        'Running processes are\n%s' % (arg1, '\n'.join(
                            [l.strip() for l in lines])))
74815
def process_kill(pid, sig=None):
    
    sig = sig or signal.SIGTERM
    os.kill(pid, sig)
462354
public function kill()
    {

        if (!$this->checkPid()) {
            // already dead
            $this->markAsDisappeared(sprintf('Did not kill job "%s" (id: %s), because it was already dead.', $this->getJobCode(), $this->getId()));
            return;
        }

        // let's be nice first (a.k.a. "Could you please stop running now?")
        if (posix_kill($this->getPid(), SIGINT)) {
            $this->log(sprintf('Sending SIGINT to job "%s" (id: %s)', $this->getJobCode(), $this->getId()));
        } else {
            $this->log(sprintf('Error while sending SIGINT to job "%s" (id: %s)', $this->getJobCode(), $this->getId()), Zend_Log::ERR);
        }

        // check if process terminates within 30 seconds
        $startTime = time();
        while (($waitTime = (time() - $startTime) < 30) && $this->checkPid()) {
            sleep(2);
        }

        if ($this->checkPid()) {
            // What, you're still alive? OK, time to say goodbye now. You had your chance...
            if (posix_kill($this->getPid(), SIGKILL)) {
                $this->log(sprintf('Sending SIGKILL to job "%s" (id: %s)', $this->getJobCode(), $this->getId()));
            } else {
                $this->log(sprintf('Error while sending SIGKILL to job "%s" (id: %s)', $this->getJobCode(), $this->getId()), Zend_Log::ERR);
            }
        } else {
            $this->log(sprintf('Killed job "%s" (id: %s) with SIGINT. Job terminated after %s second(s)', $this->getJobCode(), $this->getId(), $waitTime));
        }

        if ($this->checkPid()) {
            sleep(5);
            if ($this->checkPid()) {
                $this->log(sprintf('Killed job "%s" (id: %s) is still alive!', $this->getJobCode(), $this->getId()), Zend_Log::ERR);
                return; // without setting the status to "killed"
            }
        }

        $this
            ->setStatus(self::STATUS_KILLED)
            ->setFinishedAt(strftime('%Y-%m-%d %H:%M:%S', time()))
            ->save();
    }
685178
def fatal(msg, exitcode=1, **kwargs):
    """"""
    # NOTE: Can't use normal arg named `pause` since function has same name.
    pause_before_exit = kwargs.pop("pause") if "pause" in kwargs.keys() else False
    echo("[FATAL] " + msg, **kwargs)
    if pause_before_exit:
        pause()
    sys.exit(exitcode)
1340917
def kill_the_system(self, warning: str):
        
        log.critical('Kill reason: ' + warning)
        if self.DEBUG:
            return

        try:
            self.mail_this(warning)
        except socket.gaierror:
            current_time = time.localtime()
            formatted_time = time.strftime('%Y-%m-%d %I:%M:%S%p', current_time)
            with open(self.config['global']['killer_file'], 'a', encoding='utf-8') as killer_file:
                killer_file.write('Time: {0}\nInternet is out.\n'
                                  'Failure: {1}\n\n'.format(formatted_time, warning))
307486
public void fatal(String message, Object ... args) {
    if (log.isFatalEnabled()) {
      log.fatal(String.format(message, args));
    }
  }
552681
function exec() {

  var actions = {
    commands: {
      'delete': { action: _delete },
      screenshot: { action: _screenshot }
    }
  };

  bag.command(__dirname, actions);
}
1191298
def die(self):
        """"""
        if self.process:
            _log(self.logging,
                 'Stopping {0} server with PID: {1} running at {2}.'
                     .format(self.__class__.__name__, self.process.pid,
                             self.check_url))

            self._kill()
628759
public function handle()
    {

        if (! $this->preflighted()) return;

        $killmails = CharacterKillmail::where('character_id', $this->getCharacterId())
            ->whereNotIn('killmail_id', function ($query) {

                $query->select('killmail_id')
                    ->from('killmail_details');

            })->pluck('killmail_id', 'killmail_hash');

        $killmails->each(function ($killmail_id, $killmail_hash) {

            $detail = $this->retrieve([
                'killmail_id'   => $killmail_id,
                'killmail_hash' => $killmail_hash,
            ]);

            if ($detail->isCachedLoad()) return;

            KillmailDetail::firstOrCreate([
                'killmail_id'     => $killmail_id,
            ], [
                'killmail_time'   => carbon($detail->killmail_time),
                'solar_system_id' => $detail->solar_system_id,
                'moon_id'         => property_exists($detail, 'moon_id') ? $detail->moon_id : null,
                'war_id'          => property_exists($detail, 'war_id') ? $detail->war_id : null,
            ]);

            KillmailVictim::firstOrCreate([
                'killmail_id'    => $killmail_id,
            ], [
                'character_id'   => property_exists($detail->victim, 'character_id') ?
                    $detail->victim->character_id : null,
                'corporation_id' => property_exists($detail->victim, 'corporation_id') ?
                    $detail->victim->corporation_id : null,
                'alliance_id'    => property_exists($detail->victim, 'alliance_id') ?
                    $detail->victim->alliance_id : null,
                'faction_id'     => property_exists($detail->victim, 'faction_id') ?
                    $detail->victim->faction_id : null,
                'damage_taken'   => $detail->victim->damage_taken,
                'ship_type_id'   => $detail->victim->ship_type_id,
                'x'              => property_exists($detail->victim, 'position') ?
                    $detail->victim->position->x : null,
                'y'              => property_exists($detail->victim, 'position') ?
                    $detail->victim->position->y : null,
                'z'              => property_exists($detail->victim, 'position') ?
                    $detail->victim->position->z : null,
            ]);

            collect($detail->attackers)->each(function ($attacker) use ($killmail_id) {

                KillmailAttacker::firstOrCreate([
                    'killmail_id'     => $killmail_id,
                    'character_id'    => property_exists($attacker, 'character_id') ?
                        $attacker->character_id : null,
                    'corporation_id'  => property_exists($attacker, 'corporation_id') ?
                        $attacker->corporation_id : null,
                    'alliance_id'     => property_exists($attacker, 'alliance_id') ?
                        $attacker->alliance_id : null,
                    'faction_id'      => property_exists($attacker, 'faction_id') ?
                        $attacker->faction_id : null,
                    'security_status' => $attacker->security_status,
                    'final_blow'      => $attacker->final_blow,
                    'damage_done'     => $attacker->damage_done,
                    'ship_type_id'    => property_exists($attacker, 'ship_type_id') ?
                        $attacker->ship_type_id : null,
                    'weapon_type_id'  => property_exists($attacker, 'weapon_type_id') ?
                        $attacker->weapon_type_id : null,
                ]);
            });

            if (property_exists($detail->victim, 'items')) {

                collect($detail->victim->items)->each(function ($item) use ($killmail_id) {

                    KillmailVictimItem::firstOrNew([
                        'killmail_id'  => $killmail_id,
                        'item_type_id' => $item->item_type_id,
                    ])->fill([
                        'quantity_destroyed' => property_exists($item, 'quantity_destroyed') ?
                            $item->quantity_destroyed : null,
                        'quantity_dropped'   => property_exists($item, 'quantity_dropped') ?
                            $item->quantity_dropped : null,
                        'singleton'          => $item->singleton,
                        'flag'               => $item->flag,
                    ])->save();

                    // TODO: Process $item->items as a nested model.
                });
            }
        });
    }
1240609
function kill(event, node){
    node = getNode(node);

    if (node)
      addHandler(node, event, kill);
    else
    {
      cancelDefault(event);
      cancelBubble(event);
    }
  }
949288
public void kill() {

        if (m_shell != null) {
            m_shell.exit();
        }
        if (m_loggingThread != null) {
            m_loggingThread.stopThread();
        }
        m_shell = null;
        m_updateBean = null;
    }