carlos-montiers / enhancedbatch

Enhances your windows command prompt https://www.enhancedbatch.com
Other
5 stars 1 forks source link

Limitation - Cannot pipe the output of CALL @extension #47

Open DaveBenham opened 4 years ago

DaveBenham commented 4 years ago

I don't think there is anything we can do about this, but you cannot pipe the output of a CALLed extension. For example call @help | more does not work.

It fails because CALL will abort with no error if it sees a pipe on the same line.

But you can pipe the output indirectly by using EB.CMD. The following works just fine:

eb @help | more
adoxa commented 4 years ago

It fails because it creates a new instance of cmd to run the call, that new instance does not have EB installed, thus @help does not exist.

DaveBenham commented 4 years ago

Doh! Of course. Thanks.

call echo Works | findstr "^" works just fine. The pipe is processed in phase 5.3 before CALL in phase 6. In other words CALL never sees the pipe.

I was confusing myself with the fact that call echo Doesn't work ^| findstr "^" does not work. In this case CALL does see the pipe, and aborts cleanly without error because it is too late to process the pipe.

carlos-montiers commented 4 years ago

This will be not fixed? Thus maybe can be closed with that label ?

adoxa commented 4 years ago

It can only be fixed indirectly, by automatically loading EB into child CMDs (meaning EB would have to hook CreateProcess and probably _popen to inject itself, or use AutoRun).

carlos-montiers commented 4 years ago

@adoxa maybe now we can think on auto load of eb in the child process?, now that we are careful of not introduce features that break things.