1

I used to be able to handle piping just fine, but recently I’ve been having problems with Bash truncating output when it’s piped into another command. What could be causing this?

I'm using Bash on Mac OS X 10.11.1.

The command I’m using, in this example is leveraging the Microsoft Azure Cross-Platform (xPlat) CLI Tool, which runs on top of Node.js:

azure provider list --json | pbcopy

Actual Pipeline Output Received

Commands such as jsawk or pbcopy are only actually seeing this:

jsawk: JSON parse error: '[
  {
    "resourceTypes": [
      {
        "apiVersions": [
          "2015-10-31",
          "2015-01-01-preview"
        ],
        "locations": [
          "Japan East",
          "East US 2",
          "West Europe",
          "Southeast Asia",
          "South Central US"
        ],
        "properties": {},
        "name": "automationAccounts"
      },
      {
        "apiVersions": [
          "2015-10-31",
          "2015-01-01-preview"
        ],
        "locations": [
          "Japan East",'
5
  • 1
    What happens when you run azure provider list --json | less -- does your data get truncated? Nov 17, 2015 at 19:43
  • @glennjackman: Yes, it is truncated that way as well. It seems to only be a problem with piping, because it emits full output when I don't pipe at all. The full output is emitted to stdout. I also tried using zsh, so it doesn't seem to be a problem with Bash itself. Nov 17, 2015 at 21:13
  • Maybe can be useful to have the full output to reply your problem. If I correctly understand what you posted is what it survived. If so the next character(s) should be the interesting one(s). Redirect the output to a file and see if the problem persists and if not if persists in the file if it reappears doing less outfile...
    – Hastur
    Nov 17, 2015 at 22:07
  • unless part of the output goes to stderr. Try azure ... 2>&1 | less Nov 17, 2015 at 22:11
  • I tried the 2>&1 | less redirection, and it's still truncated there. Nov 20, 2015 at 21:40

0

You must log in to answer this question.

Browse other questions tagged .