Detecting success/error in cli protocol?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23. 05. 2018 16:42, Tanu Kaskinen wrote:
> On Thu, 2018-05-17 at 08:28 +0200, Tomaž Šolc wrote:
>> Does anyone have any thoughts on how proper error handling could be
>> implemented in the cli interface? I would be happy to work on a patch to
>> fix this.
> 
> Getting an error message from the "play-file" command is just a matter
> of printing the error in pa_cli_command_play_file(). It already prints
> errors when it detects bad parameters, but if pa_play_file() fails,
> that doesn't currently result in any error message. A patch for this
> would be welcome.

Ok. I'll prepare a patch for that.

> You asked about "proper" error handling, and in my view that includes
> something better than just ad-hoc error messages. The CLI interface is
> what it is, and I don't like the idea of trying to make it a proper
> programming interface. The native protocol is what applications should
> use.

Most CLI protocols I've seen have some way of having error handling. 
Unix/dos shell exit statuses for example, or usbtmc/GPIB protocol for 
instrumentation.

A backwards-compatible approach could be to add a command that prints 
out the success/error status of the previous command.

> A "play file" command could be added to the native protocol, although
> I'm not sure it should. PulseAudio isn't a media player, after all...

I understand that playing files isn't something PulseAudio should focus 
on. The "play-file" does come very handy in the specific embedded 
application I'm working on. In regard to media playback I need only to 
play a single .wav, and using "play-file" means that I can offload 
everything audio-related to the PulseAudio daemon.

Best regards
Tomaž


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux