start /tabna leaves blank windows when running batch scripts

Nov 15, 2010
8
0
Hi Folks,
I'm running one
START /TABNA after another in a batch script in order to setup my preferred development environment (which is take command of course!)

I'm using TakeCommand V15 64 bit but I tested this under several versions - it seems to have the same issue.

It looks like this:

REM File: SETDEV.BTM
start "build client" /tabna tcc /c "buildjs" watch
start "build node" /tabna tcc /c "buildnode" watch
start "test client" /tabna tcc /c "testjs"
REM start "test node" /tabna tcc /c "testnode"
start "test lib" /tabna tcc /c "testlib"
start "fossil" /tabna "fossil" ui --port 8967

buildjs, buildnode, testjs, testnode are all batch files that run NodeJS commands. NodeJS is a Javascript interpreter based on Chrome's V8 engine.

When I run this simple batch script, I get a bunch of "broken" tabs. That is, they show all white windows and each has a tab name that is missing -- except for the fossil one at the end which always works well (and isn't a batch file.)

To fix, I tried inserting delay commands between each start. This had no effect.

Now, when I run the same script under ConEmu it works fine (from that perspective but ConEmu has other issues).

Any ideas?
Ron
 
Nov 15, 2010
8
0
Ok, here's a shorter version you can run yourself to see the problem.

create a batch file called donothing.bat
rem file:donothing.bat
echo doing nothing

then run it in a tab:

start "donothing" /tab donothing.bat

I get a window that is all black and shows nothing. it just hangs. The windows cursor goes to a spinning circle. The tab has no name and I don't get the output from the echo command.
 
May 20, 2008
9,187
60
Syracuse, NY, USA
With any of v15, v16, and v17, it works sometimes and fails sometimes. When it fails, I see the likes of this.
upload_2015-1-8_13-28-47.png
I can close the bad tab, but after all this testing I have 16 orphaned instances of TCC.
 
Nov 15, 2010
8
0
Ok I've done a bit more testing. It appears that .EXE files run just fine in the other tab. I've run Digital Mars C++, Perl, Far Manager, and all work fine. The problem seems to be limited to batch files. Also, it works fine from the command line - I can execute each line of my script and it works fine. When run in a batch, it fails (different) each time, where failure is one or more broken tabs.
 

rconn

Administrator
Staff member
May 14, 2008
10,920
97
Ok, here's a shorter version you can run yourself to see the problem.

create a batch file called donothing.bat
rem file:donothing.bat
echo doing nothing

then run it in a tab:

start "donothing" /tab donothing.bat

I get a window that is all black and shows nothing. it just hangs. The windows cursor goes to a spinning circle. The tab has no name and I don't get the output from the echo command.
Do you get that running it once manually from the command line? I tried it 100 times here (manually) and couldn't reproduce it. Then I put it in a batch file loop and I could see it happen maybe three or four times out of a hundred.

Unfortunately, in the case of the loop it isn't TCC, it's the Windows create & attach console api's - they just do not behave well if called really fast from the same session. (Old bug; Microsoft knows about it but hasn't ever fixed it.)

There's another potential problem here - if you start a new tab that exits immediately (as in your "tcc /c" example), there's a good chance that the session will exit before TCMD can attach to the console and create a tab for it.

What happens with your original batch file if you add something like a "delay 1" (i.e., "start "build client" /tabna tcc /c (delay 1 & "buildjs" watch)"?
 
May 20, 2008
9,187
60
Syracuse, NY, USA
Not even a 5 second delay helps in the one I reported. Using
Code:
v:\> type donothing.btm
delay 5
echo Doing nothing!

v:\> start "donothing" /tab donothing.btm
Sometimes a dead tab is created (no title, no output) and the TCC is orphaned when the tab is closed. It also happens sometimes if I use /tabna.
 

rconn

Administrator
Staff member
May 14, 2008
10,920
97
Not even a 5 second delay helps in the one I reported. Using
Code:
v:\> type donothing.btm
delay 5
echo Doing nothing!

v:\> start "donothing" /tab donothing.btm
Sometimes a dead tab is created (no title, no output) and the TCC is orphaned when the tab is closed. It also happens sometimes if I use /tabna.
Never reproducible here. But I made a change to work around the Windows bug that causes TCC to display an empty GUI window instead of a console window in the tab (because Windows is returning a null or invalid handle when querying the console).
 
Nov 15, 2010
8
0
Never reproducible here. But I made a change to work around the Windows bug that causes TCC to display an empty GUI window instead of a console window in the tab (because Windows is returning a null or invalid handle when querying the console).
Not even a 5 second delay helps in the one I reported. Using
Code:
v:\> type donothing.btm
delay 5
echo Doing nothing!

v:\> start "donothing" /tab donothing.btm
Sometimes a dead tab is created (no title, no output) and the TCC is orphaned when the tab is closed. It also happens sometimes if I use /tabna.
Never reproducible here. But I made a change to work around the Windows bug that causes TCC to display an empty GUI window instead of a console window in the tab (because Windows is returning a null or invalid handle when querying the console).
Thanks for looking into this.

The key seems to be whether I'm running a batch script or an EXE. If it is an EXE, it never has the problem.

I tried this again today (2/14/2015) with TCMD17 "32-bit" and the problem did not occur! (2/8/2015 build) I tried repeatedly to make it fail and couldn't. I retested with V15 (32 and 64 bit) and it failed immediately. I tried V 17 -64 bit but I had tried this in the past and my 30 day key had expired!

Sounds like my solution is to upgrade to V17, which I will do.
 
Nov 15, 2010
8
0
Thanks for looking into this.

The key seems to be whether I'm running a batch script or an EXE. If it is an EXE, it never has the problem.

I tried this again today (2/14/2015) with TCMD17 "32-bit" and the problem did not occur! (2/8/2015 build) I tried repeatedly to make it fail and couldn't. I retested with V15 (32 and 64 bit) and it failed immediately. I tried V 17 -64 bit but I had tried this in the past and my 30 day key had expired!

Sounds like my solution is to upgrade to V17, which I will do.
Just for posterity - my exact version is:TCC 17.00.75 x64

Working like a champ!