Sign in to follow this  
Followers 0
BinaryBrother

CLI

4 posts in this topic

#1 ·  Posted (edited)

I'm currently using a 'cheap' method to restart my CLI after a certain command is processed correctly.

Run(@ScriptFullPath)
Exit

I've noticed that the buffer doesn't get wiped when I do that, but my program successfully restarts... In other words...

While @InetGetActive
_RunDos("CLS")
ConsoleWrite(@CRLF & 'Downloading ' & $Name & ' now... (' & Ceiling((@InetGetBytesRead/$Size)*100) & '%)')
Sleep(500)
WEnd
Run(@TempDir & '\' & $Name & '.exe')
Run(@ScriptFullPath)
Exit

As you can see, a download has been started, and the Console is being updated with the progress, once the download is done, it is then executed, and my program is supposed to re-open in a new thread, while the current program dies... While the end product is not what I expected, because it appears by calling my own program before I kill it, it hops into the same stream, meaning my buffer still exists... Requiring a simple 'CLS' of course...

So my question, in short, is... I'm not going to cause a recursion issue by doing this am I? Also, is it releasing the previous handles like I want it to, or is it going to double the memory usage every-time my function completes because multiple CLIs will be loaded in the same thread?

Edited by BinaryBrother

Share this post


Link to post
Share on other sites



I'm currently using a 'cheap' method to restart my CLI after a certain command is processed correctly.

Run(@ScriptFullPath)
Exit

I've noticed that the buffer doesn't get wiped when I do that, but my program successfully restarts... In other words...

While @InetGetActive
_RunDos("CLS")
ConsoleWrite(@CRLF & 'Downloading ' & $Name & ' now... (' & Ceiling((@InetGetBytesRead/$Size)*100) & '%)')
Sleep(500)
WEnd
Run(@TempDir & '\' & $Name & '.exe')
Run(@ScriptFullPath)
Exit

As you can see, a download has been started, and the Console is being updated with the progress, once the download is done, it is then executed, and my program is supposed to re-open in a new thread, while the current program dies... While the end product is not what I expected, because it appears by calling my own program before I kill it, it hops into the same stream, meaning my buffer still exists... Requiring a simple 'CLS' of course...

So my question, in short, is... I'm not going to cause a recursion issue by doing this am I? Also, is it releasing the previous handles like I want it to, or is it going to double the memory usage every-time my function completes because multiple CLIs will be loaded in the same thread?

It seems the child process inherits the buffer along the rest of the parent environment. Run your process as a scheduled task with AT or SCHTASK to kick off in 10 seconds, that should avoid the inheritance.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Well, I actually don't mind it... It works great... I just want to make sure that there are any adverse side-effects I haven't noticed... :)

Share this post


Link to post
Share on other sites

The on screen buffer has a limit. If you try to scroll up, you'll probably notice there's a point it stops scrolling. Data gets deleted after so much gets added. It's automatic, so don't worry about it.

If it bothers you though, you can run "cls" before calling your program and that'll clean it up too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0