Shell - continuous output?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Shell - continuous output?
I have an awesome idea, but it would require running shell commands and continuously grabbing/displaying the output.
All I can find reference to is about running a command and returning the output, is it possible to run continuously?
All I can find reference to is about running a command and returning the output, is it possible to run continuously?
Marcus
Re: Shell - continuous output?
It seems that open process might do what I need, building a small frame and then testing.
Marcus
Re: Shell - continuous output?
I have partial success!
Ok, so I can open a process and read from it, but I'm getting UI locks and not sure how to get around that.
Here's what I'm using right now:
I have a button that sets the runTheThing to false, to shut the process off, but with the GUI locking up I can't press the button.
If I press the button, nothing happens, if I then open the Task Manager and manually close the program, everything continues AND I see the "server stopped" message.
It seems that the button is recorded as pressed, but still having GUI lock.
Any ideas?
Ok, so I can open a process and read from it, but I'm getting UI locks and not sure how to get around that.
Here's what I'm using right now:
Code: Select all
command monSlave pProcess
if runTheThing is true then
read from process pProcess until linefeed
put it after field "console"
send "monSlave pProcess" to me in 50 milliseconds
else
write "^c" to process pProcess
put CR & "Server stopped" after field "console"
end if
end monSlave
If I press the button, nothing happens, if I then open the Task Manager and manually close the program, everything continues AND I see the "server stopped" message.
It seems that the button is recorded as pressed, but still having GUI lock.
Any ideas?
Marcus
Re: Shell - continuous output?
Did you try:
"read from process pProcess until EOF"
to see if its waiting for a linefeed?
Walt
"read from process pProcess until EOF"
to see if its waiting for a linefeed?
Walt
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Re: Shell - continuous output?
Set to EOF I get nothing read, still locks up but nothing displayed.
I'm running a batch file which starts a java process, so I need to continuously read the window.
I'm running a batch file which starts a java process, so I need to continuously read the window.
Marcus
Re: Shell - continuous output?
More testing.
It seems the locking is not while reading or outputting on screen, it happens BETWEEN. Which makes me think that it has to do with the "read from process pProcess for 1", if there isn't anything to read, it sits there waiting, locking up the GUI, so I'm going to try and see if I can make a check, if it is not empty, or whatever the check will actually be.
It seems the locking is not while reading or outputting on screen, it happens BETWEEN. Which makes me think that it has to do with the "read from process pProcess for 1", if there isn't anything to read, it sits there waiting, locking up the GUI, so I'm going to try and see if I can make a check, if it is not empty, or whatever the check will actually be.
Marcus
Re: Shell - continuous output?
Ok, so more success!
(Not sure if anyone is following this, but I'm amused anyway)
By turning it into read from process pProcess until empty, I'm now getting continuous output, now it's a matter of sending control characters so I can send a ctrl-c
(Not sure if anyone is following this, but I'm amused anyway)
By turning it into read from process pProcess until empty, I'm now getting continuous output, now it's a matter of sending control characters so I can send a ctrl-c
Marcus
Re: Shell - continuous output?
Newest issue is that I'm not having any luck sending ctrl-c to the process.
I do have the process opened to update, so it should accept read and write.
I do have the process opened to update, so it should accept read and write.
Marcus
Re: Shell - continuous output?
I would like to accomplish this same thing. Do you mind sharing what you've got so far? I'm trying to launch a shell that runs an executable with continuous output and pass a ctrl+c to it to stop when I push the stop button.
Re: Shell - continuous output?
Trenatos,
Just a thought, does opening the process for text or binary update affect the ability to get a Ctrl-C? And did you try close process instead?
Walt
Just a thought, does opening the process for text or binary update affect the ability to get a Ctrl-C? And did you try close process instead?
Walt
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Re: Shell - continuous output?
I don't remember if I tried that.
I gave up on implementing this in LiveCode, it was easier to do in Lazarus (Object Pascal).
I gave up on implementing this in LiveCode, it was easier to do in Lazarus (Object Pascal).
Marcus