WAD DETACH acting strangely

May 20, 2008
12,171
133
Syracuse, NY, USA
If I
Code:
detach g:\tc16\tcc.exe
I get a transient, truly detached (no conhost) instance of TCC. Is it supposed to be transient?
If, expecting the same behavior, I
Code:
v:\> echo %comspec
G:\TC16\TCC.EXE

v:\> detach %comspec
I get a non-transient detached TCC process **PLUS** a new non-transient, visible TCC process. Likewise detaching "%comspec /k" or "g:\tc16\tcc.exe /k".

Is it working correctly (especially the extra, visible TCCs)?
 

rconn

Administrator
Staff member
May 14, 2008
12,557
167
If I
Code:
detach g:\tc16\tcc.exe
I get a transient, truly detached (no conhost) instance of TCC. Is it supposed to be transient?
If, expecting the same behavior, I
Code:
v:\> echo %comspec
G:\TC16\TCC.EXE

v:\> detach %comspec
I get a non-transient detached TCC process **PLUS** a new non-transient, visible TCC process. Likewise detaching "%comspec /k" or "g:\tc16\tcc.exe /k".

Is it working correctly (especially the extra, visible TCCs)?

WAD.

First, your detached command (tcc.exe by itself) is meaningless and will do nothing at all. It would be better if you had a real-world example here -- this is critical because the contents of your command line determines how DETACH behaves.

If you are detaching an internal command, alias, or batch file, DETACH starts a transient copy of TCC to execute the command. If you are detaching an external command, DETACH runs the command directly.

DETACH does not perform any variable expansion, so your "detach %comspec" is being executed as "tcc.exe /c %comspec", and your detached copy of TCC starts another (non-detached) copy of TCC.