Question: ```
woman(lisa).
woman(maggie).

parents(lisa  , homer, marge).
parents(maggie, homer, marge).

sister(X, Y) :-
   X \= Y,
   woman(X),
   parents(X, P, M),
   parents(Y, P, M).

```

When I ran the following query, I *did not expect failure* (but got it nonetheless).

```
?- sister(lisa, X).
false.                         % expected result: X = maggie

```

Why am I seeing this behavior?

Answer: 
The way in which I have accomplished this is as follows. Say I have a `camCmd` which allows me to run a DSLR camera as my webcam, but it crashes periodically. The goal is to restart it automatically without disrupting the stream. The code below does exactly that.

```js
const { spawn } = require('child_process')

const camCmd = `gphoto2 --stdout --capture-movie | \
  ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p \
  -loglevel error -f v4l2 /dev/video1`

const respawn = spawned => {
  spawned.on('close', () => {
    respawn(spawn(camCmd, { shell: true }))
  })
}
respawn(spawn(camCmd, { shell: true }))
```

Very simply it's a recursive function with an argument of whatever you're spawning. Which, once closed calls itself with the newly spawned arg.
Under what conditions are you trying to restart it? When it errors out, or on a specific condition? If the former, check out: <http://schier.co/blog/2013/01/06/restarting-workers-in-a-nodejs-cluster.html>

I was able to set up my server to auto-restart on errors by nesting my server in the following method, modified from the link above:

```
var cluster = require('cluster');

if (cluster.isMaster) {
    cluster.fork();

    cluster.on('exit', function(deadWorker, code, signal) {
        // Restart the worker
        var worker = cluster.fork();

        // Note the process IDs
        var newPID = worker.process.pid;
        var oldPID = deadWorker.process.pid;

        // Log the event
        console.log('worker '+oldPID+' died.');
        console.log('worker '+newPID+' born.');
    });
} else {
  // server code is initialized here
}

```