Closed sathanu closed 6 years ago
On Tue, Apr 10, 2018 at 09:53:30AM +0000, Sathanu wrote:
I have created a small screen with start and stop button by minigui. I want to start a service(*.exe) by the button click. When i do this, the screen comes to not responding. Is there any async library you have in the collection ? How to call exe asynchronously ?
Do you need to process output from that exe or just run it in the background without caring what it prints?
just run it in the background without caring what it prints.
In that case, Phobos' spawnProcess or spawnShell functions should do what you need. http://dpldocs.info/experimental-docs/std.process.spawnProcess.1.html
lemme know if that works for you. I do have a couple other options, but if this function works it is simpler.
It is not working. The *.exe is vibe.d application. Can we start the vibe.d application in the click event of button ?
On Tue, Apr 10, 2018 at 06:16:44PM +0000, Sathanu wrote:
It is not working. The *.exe is vibe.d application. Can we start the vibe.d application in the click event of button ?
It shouldn't matter what the exe is. What are you seeing when you try to run it? Does it throw an exception, or block on the call or what?
The service is started. but the screen is not responding.
On Tue, Apr 10, 2018 at 11:21:48AM -0700, Sathanu wrote:
The service is started. but the screen is not responding.
OK, what's the code you run in the button's click handler?
void hello(HTTPServerRequest req, HTTPServerResponse res) { res.writeBody("Hello, World!"); }
auto router = new URLRouter; router.get("/hello", &hello); auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = ["::1", "127.0.0.1"]; listenHTTP(settings, router); runApplication();
Well, that's the code in the exe, but I mean in your minigui code.
If we make the below code work in minigui button click, No need to call the exe. It will reduce the difficulty. Is this possible ?
void hello(HTTPServerRequest req, HTTPServerResponse res) { res.writeBody("Hello, World!"); }
auto router = new URLRouter; router.get("/hello", &hello); auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = ["::1", "127.0.0.1"]; listenHTTP(settings, router); runApplication();
On Tue, Apr 10, 2018 at 09:51:46PM -0700, Sathanu wrote:
If we make the below code work in minigui button click, No need to call the exe. It will reduce the difficulty. Is this possible ?
put it in a new thread. I'm not sure if vibe will love that, but that's how I'd start.
so the main thread then is your gui, and vibe lives in a worker thread that the gui can start and stop.
Thanks. It is working now.
Sweet!
I have created a small screen with start and stop button by minigui. It looks good. I want to start a service(*.exe) by the button click. When i do this, the screen comes to not responding. Is there any async library you have in the collection ? How to call exe asynchronously ?