Performance differences between spawn() and spawn_bash()
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- cli, operating-systems
Direzione di ricerca
Iniziare riproducendo la temporizzazione segnalata con spawn_bash()/execute() e spawn()/exp_string(), utilizzando i due esempi Rust e i valori di timeout indicati nell’issue. Confrontare i percorsi PtyReplSession e PtySession, quindi aggiungere una copertura di regressione che dimostri che il completamento corretto dei comandi non dipende dal timeout configurato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hello, this is perhaps not an issue, but I've been experimenting with the crate and notice the following behavior:
If I get a PtyReplSession with spawn_bash(Some(timeout)), and then use p.execute(command, ready), the time it takes for this to successfully return is directly related to timeout regardless of the time it actually takes command to reach ready. The higher the timeout, the longer it takes (but it returns Ok), and viceversa (though at a certain point, very small timeouts will fail to find ready).
If I get a PtySession with spawn(command, Some(timeout)), and then use p.exp_string(ready), the time it takes for this to successfully return is independent of timeout. I can change timeout as much as I want (as long as I don't make it too small), and the time to successfully return will remain constant. If ready is not found, the timeout works as expected.
I wouldn't expect the execution time of command to change when running in a PtySession vs a PtyReplSession. Could you explain why this happens? Is it a bug or am I missing something?
Example code with PtyReplSession:
let mut bash_session = spawn_bash(Some(10000))
.expect("session failed");
bash_session.execute("hostname", "mypc")
.expect("command failed");
Example code with PtySession:
let mut session = spawn("hostname", Some(10000))
.expect("session failed");
session.exp_string("mypc")
.expect("command failed");
Here are some test results:
Test: PtyReplSession with 2,000ms timeout:
running 1 test
test pruebas_rexpect::with_pty_repl_session_timeout_2000 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.42s
Test: PtyReplSession with 10,000ms timeout:
running 1 test
test pruebas_rexpect::with_pty_repl_session_timeout_10000 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 10.45s
Test: PtySession with 2,000ms timeout:
running 1 test
test pruebas_rexpect::with_pty_session_timeout_2000 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.19s
Test: PtySession with 10,000ms timeout:
running 1 test
test pruebas_rexpect::with_pty_session_timeout_10000 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.16s
- Lingua principale
- Rust
- Stelle
- 391
- Fork
- 69
- Merge medio
- 1g 34m
- PR unite (30g)
- 2
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rust-cli/rexpect
-
Strict output expectations Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
Configurable sleeps Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
Tutte le issue di rust-cli/rexpect
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
web-infra-dev/rspack#15847 ·