[Gambas-user] SHELL or EXEC background with gb.web.gui

Mayost Sharon sharon at 455.co.il
Mon Dec 28 09:43:14 CET 2020


---------- Original Message -----------
From: Benoît Minisini <g4mba5 at gmail.com>
To: user at lists.gambas-basic.org
Sent: Thu, 24 Dec 2020 20:29:13 +0100
Subject: Re: [Gambas-user] SHELL or EXEC background with gb.web.gui

> Le 24/12/2020 à 17:58, Mayost Sharon a écrit :
> > Hello
> > 
> > (For example I did sleep but in practice I need to run a command to
> > convert that it takes some time)
> > 
> > I'm trying to run any command in the background without WAIT
> > 
> > so:
> > 
> > Export
> > 
> > Public Sub WebTimer1_Timer()
> > 
> > WebLabel1.Text = Now()
> > 
> > End
> > 
> > Public Sub WebButton1_Click()
> > 
> > Dim hProcess As Process
> > 
> > hProcess = Shell "sleep 5" As "myp"
> > 
> > End
> > 
> > Public Sub myp_Kill()
> > 
> > WebLabel2.Text = "Kill"
> > 
> > End
> > 
> > 
> > I see that it continues to the next line but on the page I see that
> > the time display is stopped until the end of the command.
> 
> Normally WebTimer1_Timer() should work as expected. Can you post your 
> project?
> 
> > 
> > At the end of the command he does not update what is inside the Kill
> > event WebLabel2.Text = "Kill"
> 
> Alas, as I explained in the other mail, rhe server cannot trigger 
> anything on the client. It can only act in the response of a request 
> coming from the client, which is normally a GUI interaction or a 
> WebTimer tick.
> 
> Maybe there is two possible tricks :
> 
> 1) Opening a request forever, so that at any moment the server can act 
> by responding to it. The problem is that request timeout can occur at 
> any moment. But maybe it is enough to restart the request in that case.
> 
> 2) Using "WebSocket", a browser feature. But I have never used it, and 
> never looked at the documentation. So maybe this is not possible.
> 
> Regards,
> 
> -- 
> Benoît Minisini
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
------- End of Original Message -------

Hello

I am attaching a project

Sorry
It seems to me because of my English you did not understand me correctly:

The shell command should run the command on the server. (Like the exec command within PHP).

So my question is if the command is supposed to take a long time on the server then I can not use it?
That bad!

That's why in the previous email she wrote to me:
  do not be synchronous, be asynchronous using the event loop!

It does not work

I also tried to add the character "&" at the end of the command and also did not work.

Many thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_shell.zip
Type: application/zip
Size: 16719 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201228/de5d4073/attachment-0001.zip>


More information about the User mailing list