Skip to content

Running yq command via SSH will not close the output #2103

Closed
@tjsturos

Description

@tjsturos

When running a shell script (bash) that contains a yq command OR directly using yq via ssh command, the script or command will not terminate.

E.g. ssh my-ssh-config-hostname "yq '.settings.log_file' <path-to-config-file" will output the expected output from the file, but then will not terminate. My scripts then get hung up and will not continue.

When I run the same command from a logged in shell (not executing via ssh command), i.e. if I do ssh <ssh-config-hostname> and then in the logged in terminal run the same command, 'yq '.settings.log_file' " it outputs just fine and terminates awaiting the next command as expected.

Version of yq: 4.20.1
Operating system: Ubuntu 22.04 server
Installed via: download

#!/bin/bash
VERSION=v4.20.1
BINARY=yq_linux_amd64
COMPRESSED_FILENAME=${BINARY}.tar.gz
sudo wget -q https://github.com/mikefarah/yq/releases/download/${VERSION}/${COMPRESSED_FILENAME} 
tar -xzf $COMPRESSED_FILENAME &> /dev/null

if [ -f /usr/bin/yq ]; then
    sudo rm /usr/bin/yq
fi

sudo mv $BINARY /usr/bin/yq
sudo rm $COMPRESSED_FILENAME

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data1.yml:

settings:
    cpulimit:
        enabled: false
        limit_percentage: 70
    install:
        ssh:
            disable_password_login: true
    debug: false
    log_file: debug.log

Command
The command you ran:

ssh my-host "yq '.settings.log_file' config.yml" 
// or
ssh my-host "command-that-calls-above-yq.sh"

Actual behavior

debug.log
<cursor awaiting command termination>

Expected behavior

debug.log
user@local-hostname:~/tools$

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions