forked from mirrors/nixpkgs
switch-to-configuration: Use systemctl's --no-legend flag
This commit is contained in:
parent
7ddcd7b6b6
commit
37e6e08cde
|
@ -65,12 +65,12 @@ $SIG{PIPE} = "IGNORE";
|
|||
sub getActiveUnits {
|
||||
# FIXME: use D-Bus or whatever to query this, since parsing the
|
||||
# output of list-units is likely to break.
|
||||
my $lines = `LANG= @systemd@/bin/systemctl list-units --full`;
|
||||
my $lines = `LANG= @systemd@/bin/systemctl list-units --full --no-legend`;
|
||||
my $res = {};
|
||||
foreach my $line (split '\n', $lines) {
|
||||
chomp $line;
|
||||
last if $line eq "";
|
||||
$line =~ /^\*?\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s/ or next;
|
||||
$line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s/ or next;
|
||||
next if $1 eq "UNIT";
|
||||
$res->{$1} = { load => $2, state => $3, substate => $4 };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue