ComfyUI Node

Shell_Command

A shell on your ComfyUI server (please be careful with it)

By celsojr2013·Created 2 years ago·Updated 2 years ago· 0
Shell_Command
    • RETURN_CODE
    • STD_OUT
    • STD_ERR
    • COMMAND
    command
    params

    Some workflows need a bit of operating system. Rename a file, run ffmpeg, curl an endpoint, copy freshly generated images into an archive folder. ComfyUI has no native node for that, so this pack ships one that just... runs a shell command on the server. That's the whole node. It's not a generation tool, it's glue - the "I need to do something ComfyUI can't express" escape hatch.

    This one ships in the Jamworks pack because the author wanted to orchestrate DAM file tasks in workflows, but nothing about it is Jamworks-specific. It will happily run anything on your machine, which is simultaneously the point and the hazard.

    How it works

    You give it a command (the executable) and params (a multiline argument list). The params string is split per line and then on :, so a line like value1:value2:value3 becomes three separate arguments. Everything gets joined into one string and executed with subprocess.run(..., shell=True). That last part matters: shell=True means you're not running a binary with args, you're handing a string to the shell. Pipes, redirects, &&, globs, $() - all of it works, for good and ill.

    Want proof it's alive? command = echo, params = hello:world, and you get hello world back in STD_OUT.

    The outputs

    Four of them, which is generous for a node this small:

    • RETURN_CODE (INT) - 0 means success.
    • STD_OUT (STRING) - what the command printed.
    • STD_ERR (STRING) - what it printed to stderr.
    • COMMAND (STRING) - the assembled command string.

    That last one is genuinely useful, because the colon-splitting is easy to mispredict. When something isn't behaving, check what it actually assembled before you blame the command.

    Install

    Same as the rest of the pack - one install gets you all three nodes:

    # ComfyUI Manager: search "comfyui_jamworks_client", or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/celsojr2013/comfyui_jamworks_client
    

    Restart, find it under "Jamworks". Only dependency is requests, no models, nothing heavy. Repo's been dormant since mid-2024, so treat the current behavior as the final behavior.

    Traps worth knowing

    • Spaces are the classic. Args split on : and rejoin with spaces, so a filename with a space in it becomes two arguments unless you quote it.
    • There's no timeout. ComfyUI runs nodes synchronously in the server process, so a hung command - sleep 100, anything waiting on stdin - freezes the whole server until it returns. Never run interactive tools through this.
    • STD_OUT and STD_ERR come back as raw bytes, not decoded text, because the subprocess runs without text=True. A downstream node expecting a clean string can get an encoding surprise.
    • It runs as the user who launched ComfyUI, with that user's full OS permissions. The README says it plainly: incorrect usage "may cause permanent system damage! Like run a 'rm -rf /' command."

    The part that should make you pause

    This is arbitrary code execution sitting on whatever machine runs your ComfyUI. The custom-node ecosystem has a documented history of abuse here - installing a node means running its author's code with no sandbox, which is exactly how the 2024 LLMVISION malware incident went down. A node whose entire purpose is running any command you type turns an unauthenticated, network-exposed ComfyUI into a remote-code-execution-in-a-box. If your server is reachable from a network you don't fully control, do not install this pack. On a local, single-user box it's fine - just read every workflow you load before running it, because workflow JSON can carry commands too. With great power, etc.

    CategoryJamworks

    Inputs (2)

    NameTypeDefaultDescription
    commandSTRING
    paramsSTRING

    Outputs (4)

    NameTypeDescription
    RETURN_CODEINT
    STD_OUTSTRING
    STD_ERRSTRING
    COMMANDSTRING