Stop program with ShellJs command

397 Views Asked by At

I'm using codeceptjs with shelljs.

In one of tests I'm invoking a Go application like this:

const shell = require('shelljs')


let execution = shell.exec('./myGoApplication')
execution.kill();

I tried to stop it with kill with different params but it is not working.

Does anyone knows how to stop Go application from running?

EDIT:

This code doesn't stop either

execution.kill('SIGINT');

https://github.com/shelljs/shelljs

1

There are 1 best solutions below

0
Charlie On

The kill command accepts the termination signal as its first argument.

let execution = shell.exec('./myGoApplication')
execution.kill('SIGINT');

Here is a list of all signals:

https://unix.stackexchange.com/a/317496