Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`chws` w/o argument does not change current workspace to main

Aperta Adatta ai principianti
#25 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
ruby
Ambito
cli

Direzione di ricerca

Inizia in lib/irb/ext/change-ws.rb, in IRB::Context#change_workspace, e verifica come viene salvato home_workspace quando chws viene chiamato con e senza argomento. Riproduci la sequenza documentata con chws Object.new seguito da chws. Il lavoro è completato quando il comando senza argomenti torna allo spazio di lavoro principale originale, come descritto in doc/irb/irb.rd.ja.

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

Descrizione

The document (doc/irb/irb.rd.ja) says chws or irb_change_workspace command with no arguments changes the current workspace to the home workspace (i.e. the main object assigned to self when IRB begins). This does not happen in some cases.

Using irb 1.1.0.pre.2 with MRI master (d806078237).

The following example illustrates the problem -- the second invocation of chws, without an argument, is expected to change the workspace back to main. Actually, the workspace is not changed.

irb(main):001:0> chws Object.new
=> #<Object:0x000055c15c4919e8>
irb(#<Object:0x000055c15c4919e8>):002:0> chws
=> #<Object:0x000055c15c4919e8>
irb(#<Object:0x000055c15c4919e8>):003:0>

The cause of the problem seems to be IRB::Context#change_workspace at lib/irb/ext/change-ws.rb#L32, which saves the @home_workspace (via #home_workspace) only when it is first called without arguments, while it should do so before changing the workspace.

Lingua principale
Ruby
Stelle
477
Fork
159
Merge medio
22h 56m
PR unite (30g)
12

Preparare l'ambiente

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 ruby/irb

Tutte le issue di ruby/irb

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.