Thank you in advance.
When I try to launch a cli-based music player via bash, all is well and the player (mplayer) works with a simple path passed on the command line (/home/pi/Music/*).
However, when I run the same player from another app via posix_spawn(), it seems to immediately become defunct:
pi 7974 7973 51 21:45 pts/0 00:00:05 [mplayer] <defunct>
I want to retain the pid of the spawned player (so I can terminate it later) but I don't want the parent process to wait, either.
What could I possibly be missing, please?
Code follows:
#define PLAYERPATH "/usr/bin/mplayer"
//...
char *argV[] = {PLAYERPATH, "-really-quiet", "-shuffle", "-loop 0", "/home/pi/Music/*", (char *) 0};
I expected the mplayer application to simply start playing music, I suppose.
I'm not entirely sure why this makes a difference (though I'd love an explanation), but what made the difference here was not spawning mplayer directly, but rather spawning
/bin/shand letting it run mplayer as follows:Leaving this here in the hopes it will be helpful to others.