Skip to content

Cannot pipe results to jq #53

@yiwork

Description

@yiwork

Version of cli: pspace v1.8.0 (build date: Mar 15, 2024, 2:03 PM; commit: c4bbfdf)
OS: MacOS 12.7.3

Sample command:

pspace machine get <machine_id> -j -F state  | jq '.'

#error:
jq: parse error: Invalid numeric literal at line 1, column 2
error: Uncaught BrokenPipe: Broken pipe (os error 32)
    at async file:///home/runner/work/cli/cli/lib/loading.ts:33:21

To get around this error, I attempted to capture results into a variable then pipe to jq:

state_query=$(pspace machine get ps3w6f5y34e8 -j -F state)
echo $state_query | jq '.'

# error:
jq: parse error: Invalid numeric literal at line 1, column 2

Further examination:

echo $state_query > state_query.txt
vi state_query.txt 

# inside text looks like this:
^[[?25l㊂ Loading
^[[1A^[[J㊀ Loading
^[[1A^[[J^[[?25h{
  "state": "ready"
}

So it seems like the new feature of adding a prompt-like feature to let people know results are being fetched is making jq processing impossible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions