xmyshell 0.2.7__tar.gz → 0.2.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xmyshell-0.2.7/xmyshell.egg-info → xmyshell-0.2.9}/PKG-INFO +1 -1
- {xmyshell-0.2.7 → xmyshell-0.2.9}/pyproject.toml +1 -1
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/completer.py +1 -1
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/kernel.py +22 -3
- {xmyshell-0.2.7 → xmyshell-0.2.9/xmyshell.egg-info}/PKG-INFO +1 -1
- {xmyshell-0.2.7 → xmyshell-0.2.9}/LICENSE +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/README.md +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/setup.cfg +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/__init__.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/__main__.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/data/commands.json +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/environment.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/init.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/keybindings.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/lexer.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/main.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/meta.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/themes.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/update.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell/utils.py +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell.egg-info/SOURCES.txt +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell.egg-info/dependency_links.txt +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell.egg-info/entry_points.txt +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell.egg-info/requires.txt +0 -0
- {xmyshell-0.2.7 → xmyshell-0.2.9}/xmyshell.egg-info/top_level.txt +0 -0
|
@@ -134,7 +134,7 @@ class ShellCompleter(Completer):
|
|
|
134
134
|
if len(matches) >= max_results:
|
|
135
135
|
break
|
|
136
136
|
|
|
137
|
-
for item in matches:
|
|
137
|
+
for item in sorted(matches):
|
|
138
138
|
full = os.path.join(dirname, item)
|
|
139
139
|
is_dir = os.path.isdir(full)
|
|
140
140
|
name = item + ("/" if is_dir else "")
|
|
@@ -3,6 +3,7 @@ import os
|
|
|
3
3
|
import sys
|
|
4
4
|
import runpy
|
|
5
5
|
import subprocess
|
|
6
|
+
import signal
|
|
6
7
|
import shlex
|
|
7
8
|
from .environment import namespace, aliases, xmyshell_alias, xmyshell_unalias
|
|
8
9
|
from .utils import pywarning, pyerror, getcwd
|
|
@@ -14,6 +15,24 @@ def _reload() -> None:
|
|
|
14
15
|
xmyshell_reload()
|
|
15
16
|
|
|
16
17
|
|
|
18
|
+
def _run(*args, **kwargs) -> subprocess.CompletedProcess:
|
|
19
|
+
# Block SIGINT in the parent while the child runs, so that a Ctrl-C
|
|
20
|
+
# delivered to the console/process group is handled solely by the child.
|
|
21
|
+
#
|
|
22
|
+
# Without this, subprocess.run() would catch the KeyboardInterrupt
|
|
23
|
+
# raised in the parent, wait briefly, and then send SIGKILL to the
|
|
24
|
+
# child -- which is not what a shell should do. Here the parent stays
|
|
25
|
+
# silent, the child receives SIGINT as usual, and the caller's
|
|
26
|
+
# KeyboardInterrupt handler only fires for Ctrl-C at the prompt.
|
|
27
|
+
#
|
|
28
|
+
# Must run on the main thread: signal.signal() is not allowed elsewhere.
|
|
29
|
+
old = signal.signal(signal.SIGINT, signal.SIG_IGN)
|
|
30
|
+
try:
|
|
31
|
+
return subprocess.run(*args, **kwargs)
|
|
32
|
+
finally:
|
|
33
|
+
signal.signal(signal.SIGINT, old)
|
|
34
|
+
|
|
35
|
+
|
|
17
36
|
def xmyshell_source(path: str) -> None:
|
|
18
37
|
_updated = runpy.run_path(
|
|
19
38
|
path_name=os.path.expanduser(path),
|
|
@@ -162,7 +181,7 @@ def xmyshell_raw_command(cmd_line: str) -> int | None:
|
|
|
162
181
|
return 0
|
|
163
182
|
|
|
164
183
|
case "update":
|
|
165
|
-
returncode =
|
|
184
|
+
returncode = _run(
|
|
166
185
|
[sys.executable, "-m", "xmyshell.update"]
|
|
167
186
|
+ (args[1:] if len(args) > 1 else [])
|
|
168
187
|
).returncode
|
|
@@ -312,11 +331,11 @@ def xmyshell(cmd_line: str) -> int:
|
|
|
312
331
|
if os.name == "nt":
|
|
313
332
|
cmd_line = _fix_first_word(cmd_line)
|
|
314
333
|
if target_var:
|
|
315
|
-
result =
|
|
334
|
+
result = _run(
|
|
316
335
|
cmd_line, shell=True, env=os.environ, capture_output=True, text=True
|
|
317
336
|
)
|
|
318
337
|
namespace[target_var] = result.stdout
|
|
319
338
|
else:
|
|
320
|
-
result =
|
|
339
|
+
result = _run(cmd_line, shell=True, env=os.environ)
|
|
321
340
|
|
|
322
341
|
return result.returncode
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|