pty.js
pty.js copied to clipboard
Fixed install warning
./src/unix/pty.cc: In function ‘v8::Handle<v8::Value> PtyFork(const v8::Arguments&)’:
../src/unix/pty.cc:185:34: warning: ignoring return value of ‘int chdir(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
if (strlen(cwd)) chdir(cwd);
Isn't your if condition backward?
ignoring return value of ‘int chdir(const char*)’, declared with attribute warn_unused_result
Looks like result of chdir should not be ignored and this if condition checks it.
Oh, I suppose chdir returns 1 for errors rather than false, huh? If so, my mistake.
On success, zero is returned. On error, -1 is returned. chdir(2).
Gotcha, sorry for the confusion!
That's OK, I don't think that it would be merged sometime anyway, I created this pull request nearly year ago :). Nobody looks after this repository. I even tried to find something similar to pty.js and tty.js but under active development. Nothing unfortunately.
That's actually why I commented: I forked the repo and was going to start merging pull requests into my own version of it, so I wanted to verify the correctness of this change. :smile:
I see, I think it's great idea. I thin this commit good thing to merge, because of install warning. Anyway it is better to change perror("chdir failed"); -> perror("chdir " + cwd + " failed");
Noted, thanks!
@coderaiser: If you're interested, you can check out my fork now:
- https://github.com/JamesMGreene/node-partty
- https://www.npmjs.com/package/partty