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
|
- GNOME: Fix maximize state not being remembered when focus changes and window
|
||||||
decorations are hidden (:iss:`3507`)
|
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]
|
0.20.1 [2021-04-19]
|
||||||
----------------------
|
----------------------
|
||||||
|
|||||||
@ -306,6 +306,9 @@ def _main() -> None:
|
|||||||
create_opts(cli_opts, debug_config=True)
|
create_opts(cli_opts, debug_config=True)
|
||||||
return
|
return
|
||||||
if cli_opts.detach:
|
if cli_opts.detach:
|
||||||
|
if cli_opts.session == '-':
|
||||||
|
from .session import PreReadSession
|
||||||
|
cli_opts.session = PreReadSession(sys.stdin.read())
|
||||||
detach()
|
detach()
|
||||||
if cli_opts.replay_commands:
|
if cli_opts.replay_commands:
|
||||||
from kitty.client import main as client_main
|
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)
|
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(
|
def create_sessions(
|
||||||
opts: Options,
|
opts: Options,
|
||||||
args: Optional[CLIOptions] = None,
|
args: Optional[CLIOptions] = None,
|
||||||
@ -146,12 +154,15 @@ def create_sessions(
|
|||||||
default_session: Optional[str] = None
|
default_session: Optional[str] = None
|
||||||
) -> Generator[Session, None, None]:
|
) -> Generator[Session, None, None]:
|
||||||
if args and args.session:
|
if args and args.session:
|
||||||
if args.session == '-':
|
if isinstance(args.session, PreReadSession):
|
||||||
f = sys.stdin
|
session_data = '' + str(args.session)
|
||||||
else:
|
else:
|
||||||
f = open(args.session)
|
if args.session == '-':
|
||||||
with f:
|
f = sys.stdin
|
||||||
session_data = f.read()
|
else:
|
||||||
|
f = open(args.session)
|
||||||
|
with f:
|
||||||
|
session_data = f.read()
|
||||||
yield from parse_session(session_data, opts, getattr(args, 'title', None))
|
yield from parse_session(session_data, opts, getattr(args, 'title', None))
|
||||||
return
|
return
|
||||||
if default_session and default_session != 'none':
|
if default_session and default_session != 'none':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user