• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ferki / Rex / 15240232617

28 Feb 2025 09:08AM UTC coverage: 50.961% (+10.2%) from 40.73%
15240232617

push

github

ferki
Use placeholders for template hints

10072 of 19764 relevant lines covered (50.96%)

101.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

9.68
/lib/Rex/Interface/Exec/HTTP.pm
1
#
2
# (c) Jan Gehring <jan.gehring@gmail.com>
3
#
4

5
package Rex::Interface::Exec::HTTP;
6

7
use v5.12.5;
1✔
8
use warnings;
1✔
9
use Rex::Commands;
1✔
10

11
our $VERSION = '9999.99.99_99'; # VERSION
12

13
sub new {
14
  my $that  = shift;
×
15
  my $proto = ref($that) || $that;
×
16
  my $self  = {@_};
×
17

18
  bless( $self, $proto );
×
19

20
  return $self;
×
21
}
22

23
sub exec {
24
  my ( $self, $cmd, $path, $option ) = @_;
×
25

26
  Rex::Logger::debug("Executing: $cmd");
×
27

28
  if ( exists $option->{path} ) {
×
29
    $path = $option->{path};
×
30
  }
31

32
  if ($path) { $path = "PATH=$path" }
×
33
  $path ||= "";
×
34

35
  # let the other side descide if LC_ALL=C should be used
36
  # for example, this will not work on windows
37
  #$cmd = "LC_ALL=C $path " . $cmd;
38

39
  Rex::Commands::profiler()->start("exec: $cmd");
×
40

41
  my $new_cmd = $cmd;
×
42
  if ( Rex::Config->get_source_global_profile ) {
×
43
    $new_cmd = ". /etc/profile >/dev/null 2>&1; $new_cmd";
×
44
  }
45

46
  my $resp =
×
47
    connection->post( "/execute", { exec => $new_cmd, options => $option } );
48
  Rex::Commands::profiler()->end("exec: $cmd");
×
49

50
  if ( $resp->{ok} ) {
×
51
    $? = $resp->{retval};
×
52
    my ( $out, $err ) = ( $resp->{output}, "" );
×
53

54
    Rex::Logger::debug($out);
×
55

56
    if ($err) {
×
57
      Rex::Logger::debug("========= ERR ============");
×
58
      Rex::Logger::debug($err);
×
59
      Rex::Logger::debug("========= ERR ============");
×
60
    }
61

62
    if (wantarray) { return ( $out, $err ); }
×
63

64
    return $out;
×
65
  }
66
  else {
67
    $? = 1;
×
68
  }
69

70
}
71

72
1;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc