OnSongChange / OnStop only work in foreground

Forums:

MOC version: 
svn 2020-01-26

Hi,

Version: mocp svn pull earlier today.
zsh 5.6.2
Slackware 14.2 64bit.
screen 4.6.2
TERM=screen.linux (ssh'ing to server from plain tty/framebuffer)

I added some commands for OnSongChange and OnStop:

OnSongChange = "/home/david/scripts/moctitle %a %r %t"
RepeatSongChange = yes
OnStop = '/home/david/scripts/moctitle'

The moctitle script is just a short shell script to print song details to a
file in /tmp for reading by another application.

When it seemed not to be working I tried running mocp -F -D, and discovered it
works perfectly when running in the foreground.

I also ran it with only -D, and searched for OnSongChange in the scrollback,
but there was nothing.

Any ideas, or can I provide more info

It's not immediately obvious (in the brief time I've had today to look at it) that foreground or background would make any difference... provided your client (if that's how you are controlling the server) is connecting to the server instance you think it is.

The line in the mocp_server_log you should be looking for contains "Running command:", but you'll only get this if your MOC was configured with --enable-debug at build time.

I've tried running MOC in all the modes you suggest as well as several others and I cannot reproduce your problem. As well as that, running such "tattle-tale" scripts is something I do regularly in testing and I've not had any problem.

Please e-mail your moctitle script to mocmaint for further analysis.