The point of the server is to be able to pick a webcam and stream it, along with a few other things I already have working. I am trying to run a continuous process (mjpg-streamer) from within a node.js server. The node.js server is handling a serving a HTML page that has a select drop down binded to a javascript function to send a command to the server via socket.io. The drop down lets me select video0, video1, and none. However, whenever I try to run the server it refuses saying everything after the a particular block of code is unreachable or the code gets stuck running an infinite process. How can I execute this without locking up the server? Here is the code that causes the problem:
child = exec("video0.sh", function (error, stdout, stderr) {
sys.print('stdout: ' + stdout);
sys.print('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
The bash script video0.sh is:
cd mjpg-streamer/mjpg-streamer ;
export LD_LIBRARY_PATH=. ;
./mjpg_streamer -o "output_http.so -w ./www -p 8080" -i "input_uvc.so -d /dev/video0";
})there?chmod +x video0.sh?