Skip to content

Conversation

@JacksonTian
Copy link
Contributor

When use iojs debug -p <pid> with an invalid pid,
the debugger print internal error message also,
it not enough smart.

@Fishrock123
Copy link
Contributor

SGTM..

lib/_debugger.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use const here?

@JacksonTian
Copy link
Contributor Author

Thank you. @Fishrock123 @bnoordhuis @thefourtheye

@bnoordhuis
Copy link
Member

@JacksonTian
Copy link
Contributor Author

The smart os has a timeout error. It seems not related. And the raspbian is so slowly.

在 2015年6月2日,下午3:57,Ben Noordhuis notifications@github.com 写道:

CI: https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/749/ https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/749/

Reply to this email directly or view it on GitHub #1863 (comment).

@bnoordhuis
Copy link
Member

LGTM but can I have one more LGTM from @nodejs/collaborators? Perhaps it would be good to have a regression test for this.

lib/_debugger.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be stderr then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or simply, console.error?

@Fishrock123
Copy link
Contributor

A question, but LGTM, tests are always nice. :)

@indutny
Copy link
Member

indutny commented Jun 3, 2015

LGTM, with one nit from @Fishrock123

@JacksonTian
Copy link
Contributor Author

Add the regression test.

lib/_debugger.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to use escape \ enclosed by " or `.

console.error(`Target process: ${pid} doesn't exist.`);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn’t see template string be used in node core, so I don’t use it. If it’s recommend, I will replace it.

在 2015年6月5日,上午11:21,Yosuke Furukawa notifications@github.com 写道:

In lib/_debugger.js #1863 (comment):

@@ -1639,7 +1639,16 @@ Interface.prototype.trySpawn = function(cb) {
} else if (this.args.length === 3) {
// node debug -p pid
if (this.args[1] === '-p' && /^\d+$/.test(this.args[2])) {

  •  process._debugProcess(parseInt(this.args[2], 10));
    
  •  const pid = parseInt(this.args[2], 10);
    
  •  try {
    
  •    process._debugProcess(pid);
    
  •  } catch (e) {
    
  •    if (e.code === 'ESRCH') {
    
  •      console.error('Target process: ' + pid + ' doesn\'t exist.');
    
    We don't need to use escape \ enclosed by " or `.

console.error(Target process: ${pid} doesn't exist.);

Reply to this email directly or view it on GitHub https://github.com/nodejs/io.js/pull/1863/files#r31785321.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, We can use template string literals. We switched closure-linter to eslint.
https://github.com/nodejs/io.js/blob/master/.eslintrc#L7

When use `iojs debug -p <pid>` with an invalid pid,
the debugger print internal error message also,
it not enough smart.
@JacksonTian
Copy link
Contributor Author

@yosuke-furukawa used the template string.

@bnoordhuis
Copy link
Member

@yosuke-furukawa
Copy link
Member

Yes. LGTM.

@bnoordhuis
Copy link
Member

Here's another test run: https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/772/ - the last one failed because of style issues in the test case...

bnoordhuis pushed a commit that referenced this pull request Jun 5, 2015
When using `iojs debug -p <pid>` with an invalid pid, the debugger
printed an internal error message because it wasn't smart enough
to figure out that the target process didn't exist.  Now it is.

PR-URL: #1863
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
@bnoordhuis
Copy link
Member

Thanks @JacksonTian, landed in 81029c6.

@bnoordhuis bnoordhuis closed this Jun 5, 2015
@rvagg rvagg mentioned this pull request Jun 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants