-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fix issue #11 #56
base: master
Are you sure you want to change the base?
Fix issue #11 #56
Conversation
Thanks for your contribution! Seems like a interesting solution, will dive
deep when i come back, i'm on my vacation in Thailand this week ; )
On Tue, 2 May 2017 at 07:12 Moos ***@***.***> wrote:
Tested on OSX and CentOS & old tests pass on Windows.
------------------------------
You can view, comment on, or merge this pull request online at:
#56
Commit Summary
- Fix for issue #11 - path containing spaces.
- Fix for issue #11 - path containing spaces.
File Changes
- *M* lib/index.js <https://github.com/neekey/ps/pull/56/files#diff-0>
(32)
- *M* test/test.js <https://github.com/neekey/ps/pull/56/files#diff-1>
(24)
- *A* test/with space/sleep with space
<https://github.com/neekey/ps/pull/56/files#diff-2> (1)
Patch Links:
- https://github.com/neekey/ps/pull/56.patch
- https://github.com/neekey/ps/pull/56.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#56>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAegnkCkmQVfrv401ktWH-BD6KfTOeLOks5r1nUKgaJpZM4NNk4E>
.
--
发自移动版 Gmail
|
ping - have you had a chance to look at this yet? |
if (cmd.length > 1) { | ||
args = cmd.slice(1); | ||
if (cmd.length > 0) { | ||
args = cmd; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not a good practice to change the parameter cmd
and even use it later, too implicit. I would suggest you write a command parser like:
function commandParser(cmd) { ... }
var ret = commandParser(cmd);
var command = ret.command;
var args = ret.args;
function ensureCommand(cmd) { | ||
var command = cmd.shift(); | ||
var fs = require('fs'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, I would not change the cmd
directly, I would either get a copy of cmd or just use an index
to do the shifting.
Sorry for the late reply : ) I think the file existence checking is a brilliant idea, but my concern is that it may create performance issue if there's a huge number of results returned and you will have to check every command segment, which will end up with a lot of IO workload. Since I don't have a better solution for this issue, I think there are two things that can do to make the situation better for most of the users:
|
No problem. It's an edge case if you don't run into it :). Working on Google Chrome I ran into this very early. So well anyone else working with paths that have spaces. As for performance, I was concerned too so I ran a rudimentary test and noticed no difference. This fixes a fundamental flaw in the module -- I really don't think making it optional is the right path. I've recently published npm/chromate which fails due to this issue. |
Tested on OSX and CentOS & old tests pass on Windows.