jsonresume / resume-cli

CLI tool to easily setup a new resume 📑
https://jsonresume.org
MIT License
4.55k stars 379 forks source link

Running resume export from grunt-shell fails #53

Closed arw180 closed 10 years ago

arw180 commented 10 years ago

I'm using grunt-shell to run the resume export script and I get the following error:

/usr/local/lib/node_modules/resume-cli/node_modules/cli-spinner/index.js:16
    process.stdout.clearLine();
                   ^
TypeError: Object #<Socket> has no method 'clearLine'
    at null.<anonymous> (/usr/local/lib/node_modules/resume-cli/node_modules/cli-spinner/index.js:16:20)
    at wrapper [as _onTimeout] (timers.js:252:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

It works fine when run straight from the command line though. I think the error is coming from the spinner-cli that is being used, which seems to only work if stdout is set to the console

erming commented 10 years ago

Hello @arw180!

This spinner seems to cause a bit of a problem. And as far as I know, process.stdout doesn't not work as intended on cygwin/Windows either.

Maybe we should just remove them.

rolandnsharp commented 10 years ago

@erming The npm cli uses https://www.npmjs.org/package/char-spinner

Do you think using that would solve the problem?

arw180 commented 10 years ago

That should do the trick. I originally posted this issue on the grunt-shell repo, then realized it was a problem with the (resume) script itself, not grunt-shell. Still, @sindresorhus responded to my comment with "for resume-cli authors: they should only use the cli-spinner when process.stdout.isTTY is true"

The second option for the char-spinner you mentioned is exactly that.

rolandnsharp commented 10 years ago

I pushed the new spinner for export. It's working fine on Ubuntu. I also tried to change the publish spinner over to char-spinner.... but I can't figure out how to stop the thing without a process.exit()

I would be nice to be able to keep the spinner for people with slow connections.

It's strange, because for resume export there is no problem.

djengineerllc commented 10 years ago

You know, I noticed this too when ever I started implementing the resume-cli into joomla. I ended up modifying the spinner to comment out all of the (process.stdout.*) lines in the spinner code and it fixed it for me. I thought it had something to do with running "resume export" that it runs a new process or gets ran into a new process somehow so maybe the when the spinner called the process.stdout it was getting confused and throwing an error. IDK though.

I was calling exec in php to get the error.

arw180 commented 10 years ago

I'm having an issue testing out these latest changes. I uninstalled resume-cli and reinstalled (globally) from the GitHub repo, and confirmed that resume --version now returns 0.3.10, so I believe I'm using the latest codebase. When I run resume export -f html myresume, the html file that is generated contains only this:

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>

I'm running on OS X Mavericks 10.9.4 if that, if that's pertinent.

Also, if I reinstall 0.3.9 from NPM, things work properly again (provided I'm running it from the terminal of course).

arw180 commented 10 years ago

I take that back, reinstalling 0.3.9 is also giving me the same results. Maybe this is a server-side issue unrelated to these recent changes?

erming commented 10 years ago

I'm 7 days late to the party here, but yeah, @arw180, that Bad Gateway-error was related to a problem with the theme-manager (http://themes.jsonresume.org).

And I think @rolandnsharp fixed the problem with the spinner.

I'll close this issue.