Exit 1 on failure for LS CLI.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-03-16 21:50:04 -05:00
parent 2d43f44e6a
commit 3db6903185
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
2 changed files with 17 additions and 18 deletions

View File

@ -73,7 +73,11 @@ class LiquidsoapCommand extends CommandAbstract
/** @var AbstractCommand $commandObj */
$commandObj = $this->di->get($command->getClass());
$io->writeln($commandObj->run($station, $asAutoDj, $payload));
return 0;
$result = $commandObj->run($station, $asAutoDj, $payload);
$io->writeln($result);
return ('' === $result || 'false' === $result)
? 1
: 0;
}
}

View File

@ -206,22 +206,17 @@ class ConfigWriter implements EventSubscriberInterface
def azuracast_api_call(~timeout=2, url, payload) =
command = "liquidsoap_cli --as-autodj #{url} ${stationId}"
try
response = list.hd(
process.read.lines(
env=[("PAYLOAD", payload)],
timeout=float_of_int(timeout),
command
),
default=""
)
log("API #{url} - Response: #{response}")
response
catch err do
log("API #{url} - Error: #{error.kind(err)} - #{error.message(err)}")
"false"
end
response = list.hd(
process.read.lines(
env=[("PAYLOAD", payload)],
timeout=float_of_int(timeout),
command
),
default=""
)
log("API #{url} - Response: #{response}")
"#{response}"
end
EOF
);