Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 37
feat: stop command support windows#22
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
bfa9c9cec2fb5c0f89f2d9d9c9ce908efbeFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,21 @@ | ||
| 'use strict'; | ||
| const runScript = require('runscript'); | ||
| const REGEX = /^\s*(\d+)\s+(.*)/; | ||
| const isWin = process.platform === 'win32'; | ||
| const REGEX = isWin ? /^(.*)\s+(\d+)\s*$/ : /^\s*(\d+)\s+(.*)/; | ||
| exports.findNodeProcess = function* (filterFn) { | ||
| const command = 'ps -eo "pid,command"'; | ||
| const command = isWin ? | ||
| 'wmic Path win32_process Where "Name = \'node.exe\'" Get CommandLine,ProcessId' : | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m not familiar with Windows, is wmic a buildin command? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, from Microsoft offical docs, but I am not sure about Windows XP. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems good
| ||
| 'ps -eo "pid,command"'; | ||
| const stdio = yield runScript(command, { stdio: 'pipe' }); | ||
| const processList = stdio.stdout.toString().split('\n') | ||
| .reduce((arr, line) => { | ||
| if (!!line && !line.includes('/bin/sh') && line.includes('node')) { | ||
| const m = line.match(REGEX); | ||
| /* istanbul ignore else */ | ||
| if (m) { | ||
| const item = { pid: m[1], cmd: m[2] }; | ||
| const item = isWin ? { pid: m[2], cmd: m[1] } : { pid: m[1], cmd: m[2] }; | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not just change Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 after fix this ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my test, So I just put Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about change the ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's still confusing, ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. something wrong with the ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's weird:
refer to how-to-prevent-ps-from-truncating-the-process-name, I think I should rollback :) ? or set column width like: I'd like to rollback, any idea? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, just rollback to last review, thanks ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||
| if (!filterFn || filterFn(item)) { | ||
| arr.push(item); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.


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.
startfor win (if nottailinstead, just ignore the checker at win)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.
https://ci.appveyor.com/project/eggjs/egg-scripts
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.
PR for egg's docs, #2788