Comments (4)
Thanks for reporting this issue. I'll try to look at it this weekend when I get time.
from winpty.
FWIW, the "unix adapter" in winpty passes NULL for the winpty_start_process function. It doesn't send anything over IPC. I see that https://github.com/chjj/pty.js/blob/master/src/win/pty.cc is passing a non-NULL env parameter, though.
I think there may be misunderstanding about that parameter. From the winpty.h header:
- Start a child process. Either (but not both) of appname and cmdline may
- be NULL. cwd and env may be NULL. env is a pointer to an environment
- block like that passed to CreateProcess.
From pty.js/src/win/pty.cc:
const wchar_t *env = ToWChar(String::Utf8Value(args[3]->ToString()));
AFAICT, the string returned by ToWChar will have no embedded NUL characters and will end with one NUL character. I was intending the winpty_start_process API to accept an environment block like that of CreateProcess -- a sequence of VAR=VAL strings, separated by NUL characters, terminated by two NULs (one for the last string and one for the block itself).
That's also the reason for the p++ on https://github.com/rprichard/winpty/blob/master/libwinpty/winpty.cc#L373. The p++ is skipping over the final NUL terminator of the environment block. The following envStr.assign(env, p); line then assigns the (p - env) characters to envStr, so that envStr is the complete double-NUL-terminated environment block.
from winpty.
@rprichard Sorry about that, but you are looking at the wrong source code. Please see https://github.com/peters/pty.js/blob/master/src/win/pty.cc
from winpty.
Fixed in peters/pty.js@e18e8f9
from winpty.
Related Issues (20)
- fatal error: x86intrin.h: No such file or directory HOT 1
- Paramiko sshclient gets G?25h ?25l with cygwin ssh server when an interactive tool launched with winpty
- Feature request: Add redundant \r on line wrap
- Specifying named docker volume causes includes invalid characters problem HOT 5
- Error creating winpty: lost connection to agent?
- Is there a way to avoid winpty to set the terminal's title?
- Global configuration (g_DebugConfig) is leaked.
- xagrs return info lose slash
- "winpty bash" doesn't work from "Enter-PSSession -Computer myServer"?
- Missing text colors in MINGW64 when program runs with winpty HOT 2
- [NOTE!!!] Added support for VCPKG/CMake/dynaic+static linkage/arm64
- PREFIX environmental variable does not change installation directory
- Can not scroll buffer when using windows builtin telnet client in cygwin/msys2/vscode terminal etc
- Add support for Windows ARM HOT 2
- 'Pty is closed.' BUG in my app
- Line output is clipped to 80 columns
- Error when building under cygwin: cygwin_conv_to_win32_path was not declared in this scope HOT 3
- does libwinpty has a way to detect cmd.exe needs a input? HOT 2
- how to render CSI n G?
- winpty clears screen in Git Bash HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winpty.