Shell-Config-Generate

 view release on metacpan or  search on metacpan

t/lib/TestLib.pm  view on Meta::CPAN

  else
  {
    $output = `$fn`;
  }

  my $fail = $?;

  unless($fail)
  {
    eval $output;
  }

  my $error = $@;

  if($fail || $error)
  {
    $ctx->fail("execute/eval");
    if ($fail == -1)
    {
      $ctx->diag("failed to execute: $!\n");
    }
    elsif ($fail & 127) {
      $ctx->diag("child died with signal ", $fail & 127);
      $fail = 1;
    }
    elsif($fail >> 8)
    {
      $ctx->diag("child exited with value ", $fail >> 8);
      $fail = 1;
    }
    $ctx->diag("error:      $error");
    $ctx->diag("shell path: $shell_path");
    $ctx->diag("[src-begin]");
    {
      my $fh;
      open $fh, '<', $fn;
      $ctx->diag(do { local $/; <$fh> });
      close $fh;
    }
    $ctx->diag("[src-end]");
    $ctx->diag("[out-begin]");
    $ctx->diag(defined $output ? $output : '#undef');
    $ctx->diag("[out-end]");
  }
  else
  {
    $ctx->pass("eval");
  }

  $ctx->release;

  return $VAR1;
}

sub bad_fish
{
  my $path = shift;
  my $dir = File::Spec->catdir(tempdir( CLEANUP => 1 ), qw( one two three ));

  require IPC::Open3;
  my $pid = IPC::Open3::open3(\*IN, \*OUT, \*ERR, $path, -c => "setenv PATH \$PATH $dir");
  waitpid $pid, $?;

  my $str = do { local $/; <ERR> };

  $? != 0;
}

1;



( run in 1.045 second using v1.01-cache-2.11-cpan-6aa56a78535 )