我需要访问nfs mountpath中的文件。 我访问后,我需要看到挂起。如果挂起成功,那么我的场景就会通过。 如果我看到"许可被拒绝"或者如果访问成功,则该方案失败。
我怎么挂?挂起后,如何退出/终止该操作并继续我的程序的下一组步骤。我目前正在这样做。 如果(睡眠= 10秒){
,我可以这样做吗?The subroutine takes the command to execute, file path.
sub access_timeout($$) {
my $cmd = shift;
my $file_path = shift;
print(qq{Running the command "$cmd $file_path" on the client});
# Here, I need to handle sleep. Sleep is expected case here. something like if ($result = sleep(10)) { success}
my $output = $client=>execute(command => qq{$cmd $file_path && echo _OK_});
if ($output =~ /(.*)_OK_/s) {
croak(qq{Expected a hang, access should not work});
} elsif ($output =~ /permission denied/s || $output =~ /No such file or directory/s) {
croak(qq{expected a hang but there is response});
}
}