Closed fpqc closed 8 years ago
You can already launch as many wcmd in parallel as you want, regardless of if you used --outbash-session or not. A new cmd.exe is launched for each wcmd call (or each wstart call, for a short time).
Oh, wow, that's great!
That's actually more simple than trying to use a single cmd.exe, but there are drawbacks too (you can't modify the Win32 environment in a persistent way with cmd set VAR=x commands)
(Anecdotally, when I validated the security design based on GetExtendedTcpTable, I launched > 1000 cmd.exe and other processes in parallel.)
Sorry, @xilun so why isn't --outbash-session mode the default? That's amazing!
--outbash-session just also writes the port to ~/.config/cbwin/outbash_port
Launching multiple processes in parallel works whether or not this option is activated.
To be more precise launching stuff works like that:
(I will still simplify a bit because there are also nasty details about how Win32 processes are handled in Windows Job objects, etc.)
And now that I wrote this and read it again I see a security issue I did not thought about before, but it's not ultra critical.
@fpqc thank you for making me discover that security risk :P
@fpqc what does fpqc means? My fingers often type fqpc (not that it would mean much more for me)
fidelement plate et quasi-compacte. c'est une type de schema en la geometrie algebrique
Ok that seems crazy as hell. I shall study math until I understand that :)
Hi @xilun I was thinking about cbwin and Alex Ionescu's lxserver/lxext persistent communication socket idea, and I was thinking, you could likely do it even more easily with cbwin in session mode.
So here's the idea: when you run something like wcmd cmd or wcmd powershell when cbwin is in session mode, you have two options:
wcmd could inform outbash.exe that it's going to poll a new tcp port, and then outbash launches a new cmd.exe instance that is broadcasting over that new port, just like if we launched a new instance of outbash. If wcmd gets killed, outbash should kill the cmd that it launched.
The other option is to avoid negotiating a secondary tcp port at all, and tag communications between instances of wcmd and outbash on the session port with the PID of the wcmd instance.
The idea behind this is that you could run a single outbash session but lots and lots of wcmd instances in parallel, so for instance, you could run several copies of cmd.exe, powershell.exe, zsh, bash, etc inside of a terminal multiplexer like tmux, or in separate terminal emulators running within the same lxsession.
The benefit of the second method (tagging) is that if/when MS documents the interface that Alex Ionescu's lxserver/lxext uses, you could immediately remove the tcp loopback and pipe communications directly.