1#!/usr/bin/perl 2 3use strict; 4use Test::More tests => 1; 5use File::Spec; 6use lib qw(t/lib); 7use MyAppFail; 8delete $ENV{APPCLI_NON_EXIT}; 9 10my @argv = ("fail"); 11 12my $pid; 13if ($pid = fork) { 14 # parent 15 waitpid -1, 0; 16 my $exit_value = $? >> 8; 17 ok($exit_value == 1); 18} elsif (defined $pid) { 19 # child 20 local *ARGV = \@argv; 21 MyAppFail->dispatch; 22} else { 23 die "can not fork: $!"; 24} 25