Make whats-in-port and clear-port agree on what is in a port

Aperta
#796 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
shell
Ambito
cli

Direzione di ricerca

Inizia con bin/clear-port e bin/whats-in-port, confrontando i relativi comandi lsof e il comportamento descritto per le connessioni listening rispetto a quelle established. Conferma con un maintainer se entrambi gli script debbano segnalare solo i processi listening o se debbano differire intenzionalmente; il lavoro è completo quando la decisione è implementata o documentata in entrambi gli script e il loro output non è più accidentalmente fuorviante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bin/clear-port and bin/whats-in-port are a pair. Since #789 they no longer
agree on what "in the port" means.

$ grep lsof bin/clear-port
  lsof -ti4TCP:"$1" -sTCP:LISTEN | xargs -r kill

$ grep lsof bin/whats-in-port
  lsof -ni4TCP:"$1"

clear-port now looks only at the listening process. whats-in-port still
lists every socket on that port, so it includes established connections. A
browser with the page open shows up there.

The result is that whats-in-port 3000 can list processes that clear-port 3000 will not touch. Someone reads the first, runs the second, and the thing
they saw is still running.

#789 was right to narrow clear-port. Killing a browser because it had the
page open was the bug. The question is whether whats-in-port should narrow
to match.

Two ways to settle it:

  • Add -sTCP:LISTEN to whats-in-port, so both answer the same question.
    Simple, and the pair stays honest.
  • Leave it wide on purpose, because seeing every holder of a port is useful
    when you are working out what is going on. If we choose this, say so in a
    comment in both scripts, so the difference reads as deliberate.

Either is defensible. Having it happen by accident is not.

Lingua principale
Shell
Stelle
8.2k
Fork
1.7k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di thoughtbot/dotfiles

Tutte le issue di thoughtbot/dotfiles

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.