Author Topic: OK, SpriggsySpriggs Got to hide pipe cmd here's why:  (Read 2553 times)

0 Members and 1 Guest are viewing this topic.

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
OK, SpriggsySpriggs Got to hide pipe cmd here's why:
« on: October 31, 2020, 04:12:55 pm »
I said I was going to try speeding up my little txt searching program.  Well I got some nasty results.
I am substituting pipe.h command with my shell usage.

#1 the end of line delimiter became chr$(10) from chr$(10)+chr$(13) <-- nothing nasty here.
#2 not using the clipboard to pass data back  <-- nothing nasty here.
#3 does not require "cmd /c " to make use of "findstr" windows search program.  I can just use it.  <-- nothing nasty here.

Clean up the program a little, save it and compile.  Then the nasty part begins.

I  R U N  I T !!  Fortunately for me a used a small test list.  "Very fortunately".

When you use the pipe cmd dozens of times on name variations it will call pipe cmd 1000's of times.  In my test list.  What could be so nasty about that??  Well every time the pipe is called a new terminal window opens and gains focus then closes.  It's really nasty when focus changes so fast you can't do a damn thing to: stop, terminate it, close it or any other it within windows.  You just have to let "IT" finish.  When you can get control back.  (hard or soft) Shutdown and reboot was not a option in my case.  Loss of so much else would happen.

Unintended consequences. BUG.  Bet you didn't see this one coming.
Edit not a bug but intended.

« Last Edit: October 31, 2020, 04:57:54 pm by doppler »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: OK, SpriggsySpriggs Got to hide pipe cmd here's why:
« Reply #1 on: October 31, 2020, 04:47:51 pm »
@doppler Perhaps you should have read my other posts concerning pipecom.h or consulted the Discord where in both places I have discussed the command window popping up. It is not a bug. It is expected in Windows. I will not link the post where I discussed that and let you find it on your own but I have discussed workarounds for such things and I have also been researching hiding the console window for Windows (as that is the ONLY system that does that with popen). It is not a bug but an unfortunate occurrence which can be remedied through workarounds or the eventual extra code special for Windows that I will have to add. Again, not a bug, but I didn't expect someone to call commands "1,000s of times". Next time, perhaps you can message me so that it is more guaranteed that I will see your complaints. Or, since support is not guaranteed or expressly implied you could delve into the C++ code yourself and make any changes as much as you would like.
« Last Edit: October 31, 2020, 04:51:49 pm by SpriggsySpriggs »
Shuwatch!

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
Re: OK, SpriggsySpriggs Got to hide pipe cmd here's why:
« Reply #2 on: October 31, 2020, 05:15:25 pm »
@SpriggsySpriggs
Alright I was a little terse calling it a bug.  Sorry for that.

The consequences of the way I used it was nasty.  I don't use discord or other medias.  I was hopeful you had a quick solution. The program I changed is my most obscene usage of shell that I got.  Unfortunately it was the best/fastest way to get it done.

I don't follow the forums closely, so I missed any other discussions you may have had.  There maybe a trick over in the Linux world that could be applied.  I will look. I might even find something.

BTW,
Anytime you post code, there will be someone who use/abuse it someway you could never thought of.  It's happened to me, "I would show someone a process to do something." and they abuse it beyond the scope of the intended process.


Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: OK, SpriggsySpriggs Got to hide pipe cmd here's why:
« Reply #3 on: October 31, 2020, 05:38:37 pm »
@doppler It is also not an expected occurrence for anyone to even use SHELL to perform a command "1,000s of times". Also, yes, since the command prompt window does display then it would be displayed the entire time just as if you were using something like a=SHELL("some command") to get the exit code. You aren't going to want to pass it up and that's why the SHELL() command doesn't have a DONTWAIT option. How could it? You don't want to skip obtaining the data you were asking for. Again, look for the workarounds I have mentioned in the forum and try them out. I will eventually make some code specific to Windows that takes care of that exact issue of the command window. Like I said in the last post, it ONLY happens in Windows AND it isn't an expected behavior to run a command in such a manner where you are calling it "1,000s of times". It's better to try writing a script in a batch file that can run recursively in that scenario. There would have been no way in heck that I would have done my recursive directory listing with PowerShell by calling PowerShell each time I wanted one file. Instead, I made a long command string for PowerShell which told PowerShell to run recursively through the directories. Post some of the code you were doing that caused a catastrophic failure on your PC and I guarantee you it can be reduced to a script or some recursive command.
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: OK, SpriggsySpriggs Got to hide pipe cmd here's why:
« Reply #4 on: November 01, 2020, 05:51:47 pm »
@doppler Check the post about the Pipecom library to download the new code with Windows-specific changes.
Shuwatch!