Hi tj, I understand that for the run 
<https://metacpan.org/pod/Mojo::IOLoop::Subprocess#run> method both subs 
are required. If you don't want to do anything when the batch finish, the 
second one could be just sub {} 

i.e.

> $subprocess->run(sub { `sh runImportPhen`}, sub {});


BR,

El sábado, 21 de abril de 2018, 15:46:43 (UTC-3), Caveman Pl escribió:
>
> Hi group,
>
>
> I just want to run bash script and forget about it.
>
> I was trying just put it in backgrount with '&' sign
> `sh runImportPhen &`;
> but it  doesn't work.
>
> Because of it I'm trying with Mojo::IOLoop
>
> --------Pdataexport.pm----------------------
> package MyApp::Pdataexport;
>
> use base 'Mojolicious::Controller';
> use Date::Calc qw(:all);
> use File::Path qw(make_path remove_tree);
> use Mojo::IOLoop;
>
>
> sub importExternalPhenotypes{
>
>    ...prepare runImportPhen.sh script...
>
>     my $delay = Mojo::IOLoop->delay;
>    $delay->steps(
>        sub {
>            my $delay = shift;
>            `sh runImportPhen `;
>        }
>        );
>     $self->redirect_to('/pdataexport');
> }
>
> code above also doesn't work. When I click buton which run  
> importExternalPhenotypes subroutine I need to wait until bash script ends 
> work - (web page hangs until it finisz)
>
> I was trying also with
>
> sub importExternalPhenotypes{
>
>    ...prepare runImportPhen.sh script...
>
>
> my $subprocess = Mojo::IOLoop::Subprocess->new;
> $subprocess->run(
>   sub {
>     my $subprocess = shift;
>            `sh runImportPhen `;
>   }
>     $self->redirect_to('/pdataexport');
> );
>
>
>
> but it crash...
>
> Can you please provide some simple example code how it should be done?
>
> Thank you,
>
> tj
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to