portacode 0.2.0.dev0__tar.gz → 0.2.2__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.
- {portacode-0.2.0.dev0 → portacode-0.2.2}/PKG-INFO +1 -1
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/_version.py +2 -2
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/connection/terminal.py +29 -1
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode.egg-info/PKG-INFO +1 -1
- {portacode-0.2.0.dev0 → portacode-0.2.2}/.gitignore +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/.gitmodules +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/MANIFEST.in +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/Makefile +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/README.md +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/docker-compose.yaml +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/README.md +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/__init__.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/__main__.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/cli.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/connection/README.md +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/connection/__init__.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/connection/client.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/connection/multiplex.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/data.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/keypair.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode/service.py +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode.egg-info/SOURCES.txt +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode.egg-info/dependency_links.txt +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode.egg-info/entry_points.txt +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode.egg-info/requires.txt +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/portacode.egg-info/top_level.txt +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/pyproject.toml +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/setup.cfg +0 -0
- {portacode-0.2.0.dev0 → portacode-0.2.2}/setup.py +0 -0
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '0.2.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
20
|
+
__version__ = version = '0.2.2'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 2, 2)
|
|
@@ -89,6 +89,32 @@ __all__ = [
|
|
|
89
89
|
|
|
90
90
|
_IS_WINDOWS = sys.platform.startswith("win")
|
|
91
91
|
|
|
92
|
+
# ------------------------------------------------------------------
|
|
93
|
+
# Environment helpers
|
|
94
|
+
# ------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
# Minimal, safe defaults for interactive shells. They are **only** used when
|
|
97
|
+
# the variable is *missing* so we do not override user customisation.
|
|
98
|
+
_DEFAULT_ENV = {
|
|
99
|
+
"TERM": "xterm-256color",
|
|
100
|
+
"LANG": "C.UTF-8", # Locale that works even in very small containers
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _build_child_env() -> dict[str, str]:
|
|
105
|
+
"""Return a copy of os.environ with sensible fallbacks added.
|
|
106
|
+
|
|
107
|
+
The service managers on some platforms (e.g. systemd, Task Scheduler) run
|
|
108
|
+
Portacode with a *very* stripped-down environment that lacks variables like
|
|
109
|
+
``TERM``. That breaks many interactive commands (``clear``, ncurses apps,
|
|
110
|
+
coloured output, …). We therefore make sure such variables are present so
|
|
111
|
+
that each spawned PTY session has a predictable baseline environment.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
env = os.environ.copy()
|
|
115
|
+
for k, v in _DEFAULT_ENV.items():
|
|
116
|
+
env.setdefault(k, v)
|
|
117
|
+
return env
|
|
92
118
|
|
|
93
119
|
class TerminalSession:
|
|
94
120
|
"""Represents a local shell subprocess bound to a mux *channel*."""
|
|
@@ -274,7 +300,7 @@ class TerminalManager:
|
|
|
274
300
|
await self._send_error("pywinpty not installed on client")
|
|
275
301
|
return
|
|
276
302
|
|
|
277
|
-
pty_proc = PtyProcess.spawn(shell, cwd=cwd or None)
|
|
303
|
+
pty_proc = PtyProcess.spawn(shell, cwd=cwd or None, env=_build_child_env())
|
|
278
304
|
|
|
279
305
|
class _WinPTYProxy:
|
|
280
306
|
"""Expose .pid and .returncode for compatibility with Linux branch."""
|
|
@@ -372,6 +398,7 @@ class TerminalManager:
|
|
|
372
398
|
stderr=slave_fd,
|
|
373
399
|
preexec_fn=os.setsid,
|
|
374
400
|
cwd=cwd,
|
|
401
|
+
env=_build_child_env(),
|
|
375
402
|
)
|
|
376
403
|
# Wrap master_fd into a StreamReader
|
|
377
404
|
loop = asyncio.get_running_loop()
|
|
@@ -390,6 +417,7 @@ class TerminalManager:
|
|
|
390
417
|
stdout=asyncio.subprocess.PIPE,
|
|
391
418
|
stderr=asyncio.subprocess.STDOUT,
|
|
392
419
|
cwd=cwd,
|
|
420
|
+
env=_build_child_env(),
|
|
393
421
|
)
|
|
394
422
|
session = TerminalSession(term_id, proc, channel)
|
|
395
423
|
self._sessions[term_id] = session
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|