Fix #3523
This commit is contained in:
parent
d782654819
commit
cbf33fa14b
@ -29,6 +29,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
- GNOME: Fix maximize state not being remembered when focus changes and window
|
||||
decorations are hidden (:iss:`3507`)
|
||||
|
||||
- Fix reading :option:`kitty --session` from ``STDIN`` not working when the
|
||||
:option:`kitty --detach` option is used (:iss:`3523`)
|
||||
|
||||
|
||||
0.20.1 [2021-04-19]
|
||||
----------------------
|
||||
|
||||
@ -306,6 +306,9 @@ def _main() -> None:
|
||||
create_opts(cli_opts, debug_config=True)
|
||||
return
|
||||
if cli_opts.detach:
|
||||
if cli_opts.session == '-':
|
||||
from .session import PreReadSession
|
||||
cli_opts.session = PreReadSession(sys.stdin.read())
|
||||
detach()
|
||||
if cli_opts.replay_commands:
|
||||
from kitty.client import main as client_main
|
||||
|
||||
@ -137,6 +137,14 @@ def parse_session(raw: str, opts: Options, default_title: Optional[str] = None)
|
||||
yield finalize_session(ans)
|
||||
|
||||
|
||||
class PreReadSession(str):
|
||||
|
||||
def __new__(cls, val: str) -> 'PreReadSession':
|
||||
ans: PreReadSession = str.__new__(cls, val)
|
||||
ans.pre_read = True # type: ignore
|
||||
return ans
|
||||
|
||||
|
||||
def create_sessions(
|
||||
opts: Options,
|
||||
args: Optional[CLIOptions] = None,
|
||||
@ -146,6 +154,9 @@ def create_sessions(
|
||||
default_session: Optional[str] = None
|
||||
) -> Generator[Session, None, None]:
|
||||
if args and args.session:
|
||||
if isinstance(args.session, PreReadSession):
|
||||
session_data = '' + str(args.session)
|
||||
else:
|
||||
if args.session == '-':
|
||||
f = sys.stdin
|
||||
else:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user