Skip to content

Run Script

Run a script using various shells.

Spawns a child process of the shell and executes the script in it.

Inputs#

Port Description
Shell
The shell used to execute the script. See the documentation above for shell-specific requirements.
Script
The script to run.
Args
A list of arguments to pass to the script.
Stdin
A stream to be piped into the script's standard input (stdin).
Print
Controls where the script's output is directed.
Option System Log Node 'Output' Port
output Nothing stdout + stderr
stdout stdout + stderr stdout only
both stdout + stderr stdout + stderr
Environment Vars
A list of environment variables for the script, specified as KEY=VALUE strings.

Outputs#

Port Description
Success
Error
Output
The script's combined standard output and standard error.
Exit Code
The script's exit code. 0 typically indicates success.

Addendum#

Bash#

Bash is available by default on Linux and macOS systems. Bash (bash.exe) isn't included by default on Windows.

There are multiple ways to install Bash on Windows. Once you install one of the packages below, actrun can use it to run scripts.

ℹ After the installation of a package below, you might need to restart your terminal or process in order for actrun to pick up the new location of the Bash shell.

  • ⭐ Git for Windows While we don't need Git for actrun, it comes with a Bash shell that we can use.
  • Msys2: A collection of tools and libraries providing a Unix-like environment on Windows. It includes a Bash shell.
  • Cygwin: An extensive collection of tools from the Unix world, including a Bash shell, that can be run on Windows.

Note

For the experts amongst you, there is also Windows Subsystem for Linux (WSL). This node doesn't support the WSL Bash, even if it's the only one available. Starting an inactive WSL instance just to use Bash can slow down your action graph. If you really want to use WSL, it's better to run wsl.exe yourself via the Run Executable node.

How to print a hello world
echo "Hello, World!"

Python#

Python is a high-level, interpreted programming language widely used for general-purpose programming. It is available by default on most Linux and macOS systems. Python scripts can be run using the python shell option.

To determine which Python installation is used, actrun will first look for an executable named python3 and then python in the system's PATH. Any subsequent node run with this shell will use the same Python interpreter. If no Python installation is found, the node will fail with an error message.

To use a specific Python version, it is recommended to use the Run Executable node with the full path to the Python executable.

If you need to install a specific Python version, check out the Python Downloads page.

How to print a hello world
print("Hello, World!")

PowerShell Core (pwsh)#

PowerShell is a shell originally developed by Microsoft for task automation. Early versions were called Windows PowerShell (powershell.exe) and are included with Windows.

Newer versions (v6+) are called PowerShell Core (pwsh.exe), are cross-platform, and need to be installed manually.

To use PowerShell Core on Windows, you can download it from ⭐ GitHub Releases or install it using winget in your terminal.

winget search Microsoft.PowerShell
winget install --id Microsoft.PowerShell --source winget

To install PowerShell Core on macOS, the recommended method is using Homebrew.

brew install --cask powershell
Alternatively, you can find installers on GitHub Releases or follow the official installation guide.

To use PowerShell Core on Linux, you can find packages on GitHub Releases or follow the official installation guide.

⭐ The easiest way on many distributions is to install it via snap:

sudo snap install powershell --classic
How to print a hello world
Write-Host "Hello, World!"

Windows CMD#

The Windows Command Prompt (cmd.exe) is the default command-line shell for Windows.

This option is only available on Windows operating systems. The node automatically locates cmd.exe using the ComSpec environment variable.

To ensure proper handling of special characters, the node automatically sets the active code page to UTF-8 (chcp 65001) at the beginning of every script execution.

How to print a hello world
echo Hello, World!

ID: core/run@v1