#!/usr/bin/perl
use warnings;
use strict;
our $VERSION = 'v1.4.5';
use FindBin;
use lib "$FindBin::Bin/../lib/perl5";
use Narada::Lock qw( exclusive_lock unlock_new );
local @ARGV = @ARGV ? @ARGV : ('env', 'PS1=[LOCKED] \u@\h \w \$ ', 'bash', '--norc');
exclusive_lock();
{ local $ENV{NARADA_SKIP_LOCK} = 1;
system @ARGV;
}
unlock_new();
exit $? >> 8; ## no critic (ProhibitMagicNumbers)
__END__
=encoding utf8
=head1 NAME
narada-lock-exclusive - run command under exclusive lock
=head1 VERSION
This document describes narada-lock-exclusive version v1.4.5
=head1 USAGE
narada-lock-exclusive [/path/to/commands param ...]
=head1 DESCRIPTION
Wrapper for running other process under exclusive_lock().
Will also set environment variable NARADA_SKIP_LOCK to "1", so all scripts
executed under this wrapper will not try to set their own locks.
When executed without params will run `bash --norc` with '[LOCKED]' prefix
in $PS1.
Exit status of narada-lock-exclusive will be same as exit status of executed
command.
Script must be executed only from "project root directory".
=head1 CONFIGURATION AND ENVIRONMENT
Use var/.lock and var/.lock.new files.
Will set NARADA_SKIP_LOCK environment variable.
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L<https://github.com/powerman/Narada/issues>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
Feel free to fork the repository and submit pull requests.
L<https://github.com/powerman/Narada>
git clone https://github.com/powerman/Narada.git
=head2 Resources
=over
=item * MetaCPAN Search
L<https://metacpan.org/search?q=Narada>
=item * CPAN Ratings
L<http://cpanratings.perl.org/dist/Narada>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Narada>
=item * CPAN Testers Matrix
L<http://matrix.cpantesters.org/?dist=Narada>
=item * CPANTS: A CPAN Testing Service (Kwalitee)
L<http://cpants.cpanauthors.org/dist/Narada>
=back
=head1 AUTHOR
Alex Efros E<lt>powerman@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2008-2015 by Alex Efros E<lt>powerman@cpan.orgE<gt>.
This is free software, licensed under:
The MIT (X11) License
=cut