Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use flock with mocked file #112

Open
atoomic opened this issue Jan 27, 2022 · 0 comments
Open

Cannot use flock with mocked file #112

atoomic opened this issue Jan 27, 2022 · 0 comments
Labels
Feature Request New feature or request

Comments

@atoomic
Copy link
Contributor

atoomic commented Jan 27, 2022

When mocking a file using Test::MockFile, flock is failing

use Test::MockFile;
use Fcntl;

my $f = q[/tmp/myfile];
my $mocked = Test::MockFile->file( $f => q[content] );

open( my $fh, '>', $f ) or die;
flock( $fh, Fcntl::LOCK_EX() | Fcntl::LOCK_NB() ) or die $!;

output

flock() on unopened filehandle GEN0 at t.pl line 12.
Bad file descriptor at t.pl line 12.
@toddr toddr added the Feature Request New feature or request label Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request
Development

No branches or pull requests

2 participants