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.
```
  var serverSpawnProcess = spawn('java', [
    '-Xmx512M',
    '-Xms512M',
    '-jar',
    'server_files/minecraft_server.jar',
    'nogui'
  ]);

serverSpawnProcess.on('exit', function (code)
{
    console.log("exit here with code: ", code);
});
serverSpawnProcess.stdout.on('data', function (data) {
    console.log('stdout: ' + data);
});

serverSpawnProcess.stderr.on('data', function (data) {
    console.log('stderr: ' + data);
});

```