Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Fixed TakeCommand kills processes when closed

Apr
36
0
Hello,

I am sorry to report a serious bug in TakeCommand 36 (all builds 27-30).

When TakleCommand is closed, it terminates (kills) all processes started from a TCC tab (ConPTY). This includes:
  • all tabbed consoles (to be expected)
  • all detached consoles (somewhat surprising)
  • ShrAlias (unexpected)
  • all windowed processes started from a TCC tab (unacceptable)
#4 has been tested and verified using TCEdit, Notepad++ and even WinWord. It is obvious that TakeCommand kills these processes, since they are closed without giving the user a chance to save any pending changes (aka unsaved data). This spells disaster!

The same is true for #3 since ShrAlias gets closed and does not save the current state of the histories. It is not a bug in ShrAlias, because it saves its data when unloaded using ShrAlias /U.

The above has been tested in a pristine state, that is, no aliases, no TCMD.INI, no TCSTART and even no TCEXIT. TakeCommand is installed in the default folder:

C:\Program Files\JPSoft\TCMD36

The data (INI-files and the like) is also at the default position:

C:\ProgramData\JP Software

The OS is current (German version), that is,

Windows 11, Version 25H2, Build 26200.8246

Hope this helps (and gets corrected soon)

Dieter Kössl
 
Fixed in build 31 (already uploaded).

Not sure what you mean about "all detached consoles", because you cannot detach a ConPTY session (Windows limitation, not TCMD). You can undock / tear off a ConPTY tab window - is that what you're referring to? ConPTY sessions cannot outlive their terminal host (TCMD in this case), because there would be nothing to handle their I/O.
 
You can undock / tear off a ConPTY tab window - is that what you're referring to?

Yes! Sorry, but my wording was inaccurate.

I gather that undocked consoles must be closed when TCMD closes. I was just surprised when that first happened. At first glance this doesn't seem to be much of an obstacle. On the other hand, I have a simple alias

ADM=start /elevated "%ComSpec%"

for doing "relevant stuff". This console still gets closed in build 31 when TCMD is closed. Is it possible to keep elevated copies of TCC "alive" when TCMD closes? This would be quite useful, at least for me, since I usually close everything which isn't needed when running elevated consoles. Keeps the mind focused.
 
ADM=start /elevated "%ComSpec%"

On a tangent, it might be useful for v37 to add /CONSOLE and /CONPTY options to the START command. (Would probably require something hackish, like starting CONHOST.EXE or OPENCONSOLE.EXE and passing it the appropriate command line?)
 
Along the same line, but slightly different...
I use batch (.BTM) programs from the TCMD command line to start many apps, e.g. MS Word, FireFox, MS File Explorer. My BTM programs use the START command to start the app. It makes a difference whether the target of the BTM program is a desktop link (.LNK) or the full path to a program (.EXE). When TCMD closes using Alt-F4 or the CLOSE [X] button, any app started from a desktop link will also be force closed, with no "Save Files" warning. Using these close keys will not affect any app started from a path to its .EXE file. Also, the EXIT command will not affect apps, regardless of the way they are started from TCMD command line. Since I use many BTM programs and desktop links to open my apps, this is very troubling. I have to remember to close all my apps before closing TCMD.
Here is a summary of the observations, as replay of TCMD command line and the results:
START "Mozilla FireFox" "c:\Users\Public\Desktop\FireFox.lnk" >> FireFox session starts normally
EXIT command to TCMD >> TCMD closes but FireFox is still running
OR
[X] button or Alt-F4 >> TCMD closes and then FireFox closes (disappears)
Also
START "Word 19" "c:\Users\Public\Desktop\Word 2019.lnk" >> Word session starts normally
EXIT command to TCMD >> TCMD closes but Word is still running
OR
[X] button or Alt-F4 >> TCMD closes and then Word closes (disappears) without warning
Finally, if I use a .EXE path to the app in the START command, any way to close TCMD will not affect the running app.
 
This is Windows doing it, not TCC / TCMD.

A .lnk cannot be executed by the CreateProcess API (which has a flag to tell Windows to detach the process from the parent). LNK's are executed by ShellExecute(Ex), which doesn't have that flag. So the new process is a child of TCC, and when TCC is terminated by TCMD (by X or Alt-F4) all the child processes are terminated too.

I've made a change to 37.0.21 (already uploaded) to work around this by executing LNK files via a helper app, so they aren't tied to TCC.
 
Back
Top