VMware {code} Community
bery
Contributor
Contributor

VIX Perl, VMRunProgramInGuest and reading exitcode

Hello all,

is there posibility to read exitcode that program executed via VMRunProgramInGuest returns? I mean in Perl.

I found that there is a VIX_PROPERTY_JOB_RESULT_GUEST_PROGRAM_EXIT_CODE but this is property of Job and job are not available in VIX Perl.

Have i chance to get exitcode in Perl?

0 Kudos
3 Replies
lemke
VMware Employee
VMware Employee

You could bypass the Simple layer and go directly to the underling bindings.


Look in SImple.pm, and tweak it appropriately. Something like

sub myVMRunProgramInGuest($$$$$) {

my ($vm, $guestProgramName, $commandLineArgs, $options, $propertyListHandle) = @_;

my $err;

my $job;

my $exitCode;

$job = VMware::Vix::API::VM::RunProgramInGuest($vm, $guestProgramName,

$commandLineArgs,

$options,

$propertyListHandle,

undef, 0);

$err = VMware::Vix::API::Job::Wait($job, VIX_PROPERTY_JOB_RESULT_GUEST_PROGRAM_EXIT_CODE,

$exitCode, VIX_PROPERTY_NONE);

VMware::Vix::API::API::ReleaseHandle($job);

return $err, $exitCode;

};

bery
Contributor
Contributor

Thank you very much for your advice, but i still have problems, if i try to implement like you wrote, there was "failed to get property type" error, so i checked Constants.pm file and found out that there is no VIX_PROPERTY_JOB_RESULT_GUEST_PROGRAM_EXIT_CODE constant,

if i substitute it directly with value 3018, returned exit code is not correct (always 1307).

Do you think that this is because of version?

0 Kudos
bery
Contributor
Contributor

no use anymore

0 Kudos