Hi,
I just wanted to know if it was possible to execute shell command in a k6 script, for example there is a python script that i want to execute before because i need the data that he gives me.
Thanks for your your replies
Hi,
I just wanted to know if it was possible to execute shell command in a k6 script, for example there is a python script that i want to execute before because i need the data that he gives me.
Thanks for your your replies
You can’t execute shell commands from inside of a k6 script, for security reasons, and because we want k6 scripts to be reusable between the local, cloud, and future native distributed execution.
I’d suggest instead using a simple bash/powershell/etc. script that first calls the python script, saves its data in a .json file (which k6 can open()
) or an environment variable, and then calls k6.
To call an external command in a Python script, use any of the following methods:
You can get the stdout, stderr, the “real” status code, better error handling, etc…
It passes the command and arguments to your system’s shell.