[Gambas-user] shell command with gb.web.gui
sharon at 455.co.il
Tue Dec 8 06:32:36 CET 2020
---------- Original Message -----------
From: Benoît Minisini <g4mba5 at gmail.com>
To: user at lists.gambas-basic.org
Sent: Mon, 7 Dec 2020 21:26:47 +0100
Subject: Re: [Gambas-user] shell command with gb.web.gui
> Le 07/12/2020 à 20:23, Mayost Sharon a écrit :
> > Hello
> > gambas 3.15.2
> > fedora 32 64 bit
> > I use gb.web.gui
> > There's a problem when I finish downloading any file:
> > Event: Finish
> > I run a command through the shell
> > For example I wait 10 seconds "shell sleep 10" (sample only)
> > Indeed it works well as long as I am through the IDE
> > But if I compile and put the file on an HTTPD server in cgi-bin
> > For some reason when he finishes the standby command
> > The entire session is deleted and restarts
> > The thing is that if I execute the same command at the push of a button it works well
> > Sorry for my English, so I'm attaching a demo
> > Attached are Gambas files
> You must not use SLEEP, because the web server waits for you answer, and
> you may reach the session timeout (which is five minutes by default).
> You must run your process asynchronously, and use its "Kill" event to
> get its answer.
> You must understand that your project is normally suspended, and is
> woken up each time a request is sent by the browser.
> If you run your sub-process synchronously, you may reach the session
> If you run your sub-process asynchronously, your project will return
> (almost) immediately and be suspended until the next request, while the
> sub-process run in the background.
> When your projet wakes up again, if the sub-process has been terminated
> meanwhile, you should normally get the Kill event immediately, and then
> you can return the result in the request answer.
> If you want your user think that al is synchronously, you have to
> disable the GUI when the user starts the action, and enables it back
> when you get the result of the sub-process.
> I hope it's clearer now, it's a bit difficult to explain in english.
> In other words: don't be synchronous, be asynchronous using the event loop!
> Benoît Minisini
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
------- End of Original Message -------
First: the question is why when I run the same SHELL using the WebButton control event, it works well.
And when I run the same command through the WebFileButton control event, it does not work well.
Anyway, I also tried your advice to run the SHELL in the background like this:
Shell "/ bin / sleep 10" As "Process"
Public Sub Process_Kill ()
The thing is that when he finishes the process he goes into a Kill event
But I get an error:
Null Object In Webform1
It should be noted that "sleep" is just an example
In practice I want to upload a file to the server and perform any conversion on it and it can sometimes take a few seconds.
More information about the User