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

IPC::Run::start() breaks tempdir permission on Windows #141

Open
iynehz opened this issue Oct 4, 2020 · 0 comments
Open

IPC::Run::start() breaks tempdir permission on Windows #141

iynehz opened this issue Oct 4, 2020 · 0 comments

Comments

@iynehz
Copy link

iynehz commented Oct 4, 2020

It can be demoed via a script like below,

use strict;
use warnings;

use File::Temp;
use IPC::Run qw(start);

my ( $in, $out, $err );
my $h;
{
    my $tempdir = File::Temp->newdir;
    $h = start( ['foo.bat'], \$in, \$out, \$err );

    my $tempfile = "$tempdir/foo";
    open( my $f, '>', $tempfile );
    print $f "hello\n";
    close($f);
}
$h->finish;

where foo.bat could be any executable, I tried

@echo off
echo "hello"

Running this you get

cannot unlink file for C:\Users\xxx\AppData\Local\Temp\hMr0BtHITv\foo: Permission denied at c:/strawberry/perl/lib/File/Temp.pm line 2628.
cannot remove directory for C:/Users/xxx/AppData/Local/Temp/hMr0BtHITv: Directory not empty at c:/strawberry/perl/lib/File/Temp.pm line 2628.

If you don't run IPC::Run at all then it is good. Or if you move "start" to before creating the tempdir it's also good.

My Perl is Strawberry Perl 5.30.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant