mIRC Home    About    Download    Register    News    Help

Print Thread
#95660 26/08/04 08:37 AM
S
sort
sort
S
$exec would run an executable file and return everything it writes to stdout

#95661 26/08/04 11:49 AM
Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
Could be very useful. In addition to that, perhaps a $execcall identifier that's multi-threaded and calls a specified command when it's finished running (basically an $exec equivalent to $dllcall).

#95662 26/08/04 11:43 PM
Joined: Jun 2003
Posts: 194
N
Vogon poet
Offline
Vogon poet
N
Joined: Jun 2003
Posts: 194
Being Multithreaded is a requirenment. The main problem is when to return. What if the called application runs for say 2.5 hours? $exec couldnt simply return the data from the pipe becasue it doesnt know when the application is finished writing to it.

That said, A multithreaded version would be a nice idea. Wouldnt it make more sense to just use $run instead of adding a new identifier? Since run already runs an external app $run might make more sense.

#95663 27/08/04 02:54 AM
Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
What if the called application runs for say 2.5 hours? $exec couldnt simply return the data from the pipe becasue it doesnt know when the application is finished writing to it.

Maybe a buffer allowance on mIRC's end? Not sure if you are farmiliar with php, but you can execute a command, and have its return outputted to the webpage. Changing the buffer can also make it either wait for the application to finish before displaying it. Or, for something like the displayal of a tracert, have the buffer at 2bytes so the user can view it happening, and not think the webpage hung up.

#95664 27/08/04 08:26 AM
Joined: Jun 2003
Posts: 194
N
Vogon poet
Offline
Vogon poet
N
Joined: Jun 2003
Posts: 194
Normally id agree but i dont think buffered output in this case would work too well. Many applications could write a large amount of data etc.. making for a very large buffer.

From what i understood of the idea he wants the identifier to return the inbound data from the pipe. i.e

var %whatever = $exec(some\app.exe)

In order for that to work the app must be run and then mIRC must enter into a wait state (See WaitForSingleObject and WaitForIdleInput), and then set the variable to whatever is on the pipe. (note: this could quite easily reach 10's of kb exceeding the variable size limit).

I think the idea of an async callback would be best in this case. Just my 1 cent

On a side note $exec could use companion idents such as $readpipe and /writepipe etc.. This would work with your buffered output idea as $readpipe would simply read from that buffer returning a special value if the buffer is empty.

Last edited by Narusegawa_Naru; 27/08/04 08:30 AM.
#95665 29/08/04 06:29 AM
Q
Quietust
Quietust
Q
It could be handled similarly to the way socket I/O is done (using events, /sockread and /sockwrite, etc.) - after all, TCP/IP and stdin/stdout both operate as streams.


Link Copied to Clipboard