Add a --hold command line option to stay open after the child process exits
Fixes #667
This commit is contained in:
parent
d16215ab6e
commit
82f6fbff77
@ -26,6 +26,13 @@ def runpy(args):
|
|||||||
exec(args[1])
|
exec(args[1])
|
||||||
|
|
||||||
|
|
||||||
|
def hold(args):
|
||||||
|
import subprocess
|
||||||
|
ret = subprocess.Popen(args[1:]).wait()
|
||||||
|
sys.stdin.read()
|
||||||
|
raise SystemExit(ret)
|
||||||
|
|
||||||
|
|
||||||
def launch(args):
|
def launch(args):
|
||||||
import runpy
|
import runpy
|
||||||
sys.argv = args[1:]
|
sys.argv = args[1:]
|
||||||
@ -61,6 +68,7 @@ entry_points = {
|
|||||||
'+': namespaced,
|
'+': namespaced,
|
||||||
}
|
}
|
||||||
namespaced_entry_points = {k: v for k, v in entry_points.items() if k[0] not in '+@'}
|
namespaced_entry_points = {k: v for k, v in entry_points.items() if k[0] not in '+@'}
|
||||||
|
namespaced_entry_points['hold'] = hold
|
||||||
|
|
||||||
|
|
||||||
def setup_openssl_environment():
|
def setup_openssl_environment():
|
||||||
|
|||||||
10
kitty/cli.py
10
kitty/cli.py
@ -76,6 +76,12 @@ Path to a file containing the startup :italic:`session` (tabs, windows, layout,
|
|||||||
See the README file for details and an example.
|
See the README file for details and an example.
|
||||||
|
|
||||||
|
|
||||||
|
--hold
|
||||||
|
type=bool-set
|
||||||
|
Remain open after child process exits. Note that this only affects the first
|
||||||
|
window. You can quit by either using the close window shortcut or :kbd:`Ctrl+d`.
|
||||||
|
|
||||||
|
|
||||||
--single-instance -1
|
--single-instance -1
|
||||||
type=bool-set
|
type=bool-set
|
||||||
If specified only a single instance of :italic:`{appname}` will run. New invocations will
|
If specified only a single instance of :italic:`{appname}` will run. New invocations will
|
||||||
@ -213,6 +219,10 @@ def code(x):
|
|||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
def kbd(x):
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
def env(x):
|
def env(x):
|
||||||
return italic(x)
|
return italic(x)
|
||||||
|
|
||||||
|
|||||||
@ -124,6 +124,8 @@ def create_session(opts, args=None, special_window=None, cwd_from=None, respect_
|
|||||||
ans.tabs[-1].layout = current_layout
|
ans.tabs[-1].layout = current_layout
|
||||||
if special_window is None:
|
if special_window is None:
|
||||||
cmd = args.args if args and args.args else resolved_shell(opts)
|
cmd = args.args if args and args.args else resolved_shell(opts)
|
||||||
|
if args.hold:
|
||||||
|
cmd = ['kitty', '+hold'] + cmd
|
||||||
from kitty.tabs import SpecialWindow
|
from kitty.tabs import SpecialWindow
|
||||||
k = {'cwd_from': cwd_from}
|
k = {'cwd_from': cwd_from}
|
||||||
if respect_cwd:
|
if respect_cwd:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user