Good day to everybody
I have an Arduino Yun and I am having problems to open programs from the sketch.
Problem description:
I try to play a song from sketch in the linux side with the program "cmus" (command line musk player).
https://wiki.ubuntuusers.de/cmus/
Where the problem is not:
- The program "cmus" is working perfectly: When I connect from my PC with Putty over ssh and enter the exact same commands every thing goes well.
- The shell/run commands are working as I can execute all other commands that are not opening programs
Debug information's:
The program get stuck(not executing next line) already at the first command calling cmus.
As soon as it is stuck i can't open cmus from putty as it says:
cmus: cmus is already listening on socket /root/.cmus/socket
then I restart Arduino and try again
My code A:
#include <Console.h>
#include <Process.h>
Process p;
void setup() {
Bridge.begin();
Console.begin();
while(!Console)
{;}
Console.println("Connected");
p.runShellCommand("cmus"); // <- Stuck here
Console.println("1"); // Never executed
p.runShellCommand(":add ~/sound"); // Never executed
Console.println("2"); // Never executed
p.runShellCommand(":player-play /root/sound/ItCouldWork.mp3"); // Never executed
Console.println("3"); // Never executed
}
void loop() {
}
My code B:
p.begin("cmus");
p.run(); // <- Stuck here
Console.println("1"); // Never executed
p.begin(":add ~/sound"); // Never executed
p.run();
Console.println("2"); // Never executed
p.begin(":player-play /root/sound/ItCouldWork.mp3"); // Never executed
p.run();
Console.println("3"); // Never executed
The problem:
Obviously I am doing something terribly wrong, can someone help me?
By the way I have the same problem on all other programs of same type (vi (text editor), …)
Please do not propose me other music programs as workaround
The solution:
Big thx to ShapeShifter that posted the solution. I tested it, it is working just fine