]>
git.proxmox.com Git - pve-installer.git/blob - test/run-command.pl
7d5805e155258f0565e70c6bc1de8bc62a1f0ba4
9 use Proxmox
::Sys
::Command
qw(run_command CMD_FINISHED);
10 use Proxmox
::Sys
::File
qw(file_read_all);
13 my $log_file = File
::Temp-
>new();
14 Proxmox
::Log
::init
($log_file->filename);
16 Proxmox
::UI
::init_stdio
();
18 is(run_command
('echo test'), "test\n", 'basic usage');
20 is(run_command
('echo test', undef, undef, 1), 0, 'system()-mode');
22 my $ret = run_command
('bash -c "echo test; sleep 1000; echo test"', sub {
24 is($line, 'test', 'using CMD_FINISHED - produced correct log line');
28 is($ret, '', 'using CMD_FINISHED');
30 # Check the log for errors/warnings
31 my $log = file_read_all
($log_file->filename);
32 ok
($log !~ m/(WARN|ERROR): /, 'no warnings or errors logged');
33 print $log if $log =~ m/(WARN|ERROR): /;