[Mojolicious] How to launch gvim reliably within a mojo app?

2020-03-09 Thread Matthew Pressly
>From a mojolicious web app, I need to be able to launch gvim by clicking a link or button to edit a particular file. Currently, I have this in the app: get '/edit' => sub { my $c = shift; my $result = `/usr/bin/gvim $filename 2>&1`; $c->redirect_to('/'); }; Sometimes it

Re: [Mojolicious] How to launch gvim reliably within a mojo app?

2020-03-09 Thread Mike Lieman
I don't think you want to use Daemon::Control. How about a nice, simple fork()? On Mon, Mar 9, 2020 at 8:46 PM Matthew Pressly wrote: > From a mojolicious web app, I need to be able to launch gvim by clicking a > link or button to edit a particular file. > > Currently, I have this in the app:

Re: [Mojolicious] How to launch gvim reliably within a mojo app?

2020-03-09 Thread Stefan Adams
Would Mojo::IOLoop->subprocess work for you? Where the example shows sleep 5, put your system call to gvim? Not sure if that's a good solution if gvim is a long-running process, tho. Also, try it with `perl script daemon`

Re: [Mojolicious] How to launch gvim reliably within a mojo app?

2020-03-09 Thread Matthew Pressly
Using Mojo::IOLoop->subprocess is working for me. Here's what I have now (adapted from the example): get '/edit' => sub {     my $c = shift;     Mojo::IOLoop->subprocess(     sub {     my $subprocess = shift;     my $result = `/usr/bin/