Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant get encoding buffer to work on exec #675

Closed
vongohren opened this issue Feb 27, 2017 · 4 comments
Closed

Cant get encoding buffer to work on exec #675

vongohren opened this issue Feb 27, 2017 · 4 comments
Assignees
Labels
exec Issues specific to the shell.exec() API

Comments

@vongohren
Copy link

Node version (or tell us if you're using electron or some other framework):

7.6.0

ShellJS version (the most recent version/Github branch you see the bug on):

"version": "0.7.6"

Operating system:

Mac OS

Description of the bug:

Im trying to run
git archive --remote repo HEAD keystores/keystore.jks | tar -xO
But the encoding get fucked up when running through shelljs synchronous command.
I need to have buffer as encoding.

Example ShellJS command to reproduce the error:

exec(`git archive --remote=${url} ${branch} ${path}${file} | tar -xO`)
If you have a keystore anywhere, try that
The keystore becomes invalid.

I have noe used node directly where "buffer" works as encoding

@nfischer
Copy link
Member

Assigning @freitagbr because this is similar to the root cause of #645 (both deal with encoding issues)

@nfischer nfischer added the exec Issues specific to the shell.exec() API label Mar 8, 2017
@vongohren
Copy link
Author

No action or close? Im doing something else now

@nfischer
Copy link
Member

ping @freitagbr any action to take here?

@freitagbr
Copy link
Contributor

freitagbr commented Aug 23, 2017

Well, I'm pretty sure this would fix the problem:

var result = exec('git archive ...');
var keystone = Buffer.from(result.stdout, 'utf8');

This just converts the keystore string back into a buffer.

However, this seems like a good opportunity to add an "encoding" option to exec, so I will work on that.

@nfischer nfischer mentioned this issue Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exec Issues specific to the shell.exec() API
Projects
None yet
Development

No branches or pull requests

3 participants