mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00

* Update terminal title before executing subprocess This eliminates the need to use `pause_call_resume()`, which causes issues when it sends SIGSTOP to a process that is in the middle of a syscall (for example, the `swaymsg` command fails when it gets stopped during a `recv` syscall). Additionally, this approach is more flexible, as it allows captured commands and callable aliases to also be updated as expected in the terminal's title. * Clear prompt cache in readline shell * Add type annotation * Use reset_key() to only reset current_job * Convert into PromptField class * Support PromptField with value of None Allows {current_job:{} | } to work as expected when current_job is a PromptField. * Add tests
13 lines
418 B
Python
13 lines
418 B
Python
def test_current_job(xession):
|
|
prompts = xession.env["PROMPT_FIELDS"]
|
|
cmds = (["echo", "hello"], "|", ["grep", "h"])
|
|
|
|
prompts.reset()
|
|
assert format(prompts.pick("current_job")) == ""
|
|
|
|
with prompts["current_job"].update_current_cmds(cmds):
|
|
prompts.reset()
|
|
assert format(prompts.pick("current_job")) == "grep"
|
|
|
|
prompts.reset()
|
|
assert format(prompts.pick("current_job")) == ""
|