英文:
Stop program with ShellJs command
问题
我正在使用codeceptjs
和shelljs
。
在其中一个测试中,我像这样调用了一个Go应用程序:
const shell = require('shelljs')
let execution = shell.exec('./myGoApplication')
execution.kill();
我尝试使用不同的参数使用kill
来停止它,但它不起作用。
有人知道如何停止运行Go应用程序吗?
编辑:
这段代码也无法停止
execution.kill('SIGINT');
https://github.com/shelljs/shelljs
英文:
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');
答案1
得分: 1
kill
命令将终止信号作为其第一个参数接受。
let execution = shell.exec('./myGoApplication');
execution.kill('SIGINT');
这是所有信号的列表:
https://unix.stackexchange.com/a/317496
英文:
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:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论