Skip to content

ShellString's stdout property is inconsistent #420

@scott113341

Description

@scott113341

Hello! First of all, ShellJS is awesome, and I'm really excited about the project!

I was messing around with shx a little and noticed some inconsistent behavior with the ShellString class:

  • When a ShellString object is created with a String, the resulting ShellString's stdout property is set to that string. source
  • When a ShellString object is created with an Array, the resulting ShellString's stdout property is set to a newline-joined string of that Array with an extra newline character appended. source

Thank you, and please let me know if you'd like me to make a PR with additional ShellString tests.

shelljs|master ⇒ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
shelljs|master ⇒ git rev-parse HEAD
193efa7048d03db184ae3c27566b3a5f54699fdd
shelljs|master ⇒ node -v
v5.10.0
shelljs|master ⇒ npm -v
3.8.3
shelljs|master ⇒ node
> var shell = require('./shell.js');
undefined
> var ShellString = shell.ShellString;
undefined
> var output = new ShellString('meow');
undefined
> output.stdout;
'meow'
> var output2 = new ShellString(['cat', 'says', 'meow']);
undefined
> output2.stdout;
'cat\nsays\nmeow\n'
> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions