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

feat: set worker window title and hide it through node-ffi if windows… #51

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@waitingsong
Contributor

waitingsong commented Nov 15, 2017

…-window-controller installed

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

waitingsong added some commits Nov 15, 2017

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Nov 15, 2017

Contributor

貌似不支持 win32 平台的 npm run test

Contributor

waitingsong commented Nov 15, 2017

貌似不支持 win32 平台的 npm run test

@atian25

This comment has been minimized.

Show comment
Hide comment
@atian25

atian25 Nov 16, 2017

Member

node-ffi 是一个原生模块,我们不期望为了 1% 不到的场景,引入此类可能引起平台兼容性问题的类库,尤其是 master 这类非常需要保障稳定性的库。

如果你有需要的话,编写你的上层框架,在自己的 startCluster 里面做这个事即可。上层框架也非常简单,十行代码左右。

Member

atian25 commented Nov 16, 2017

node-ffi 是一个原生模块,我们不期望为了 1% 不到的场景,引入此类可能引起平台兼容性问题的类库,尤其是 master 这类非常需要保障稳定性的库。

如果你有需要的话,编写你的上层框架,在自己的 startCluster 里面做这个事即可。上层框架也非常简单,十行代码左右。

@atian25 atian25 closed this Nov 16, 2017

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Nov 16, 2017

Contributor

能否大致介绍下如何实现自己的 startCluster ? 必须要用个上层框架来封装么。
之前没想到更好的办法所以才想到这个不理想的实现。带来的兼容性是麻烦事(尤其是gyp)。 所以还写了个判断安装了nwwc 模块才执行相关命令。

Contributor

waitingsong commented Nov 16, 2017

能否大致介绍下如何实现自己的 startCluster ? 必须要用个上层框架来封装么。
之前没想到更好的办法所以才想到这个不理想的实现。带来的兼容性是麻烦事(尤其是gyp)。 所以还写了个判断安装了nwwc 模块才执行相关命令。

@atian25

This comment has been minimized.

Show comment
Hide comment
@atian25

atian25 Nov 17, 2017

Member

https://eggjs.org/zh-cn/advanced/framework.html

// {framework_root}/index.js
'use strict';

const egg = require('egg');
const originFn = egg.startCluster;

module.exports = Object.assign(egg, {
  Application: class Application extends egg.Application {
    get [Symbol.for('egg#eggPath')]() {
      return path.dirname(__dirname);
    }
  },

  Agent: class Agent extends egg.Agent {
    get [Symbol.for('egg#eggPath')]() {
      return path.dirname(__dirname);
    }
  },

  startCluster(...args) {
    // this is running at master process
    return originFn(...args);
  }
});
Member

atian25 commented Nov 17, 2017

https://eggjs.org/zh-cn/advanced/framework.html

// {framework_root}/index.js
'use strict';

const egg = require('egg');
const originFn = egg.startCluster;

module.exports = Object.assign(egg, {
  Application: class Application extends egg.Application {
    get [Symbol.for('egg#eggPath')]() {
      return path.dirname(__dirname);
    }
  },

  Agent: class Agent extends egg.Agent {
    get [Symbol.for('egg#eggPath')]() {
      return path.dirname(__dirname);
    }
  },

  startCluster(...args) {
    // this is running at master process
    return originFn(...args);
  }
});
@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Nov 17, 2017

Contributor

明白了。谢谢

Contributor

waitingsong commented Nov 17, 2017

明白了。谢谢

@atian25

This comment has been minimized.

Show comment
Hide comment
@atian25

atian25 Nov 17, 2017

Member

你们非要在 win 上部署么? 不能搞个 docker ?

Member

atian25 commented Nov 17, 2017

你们非要在 win 上部署么? 不能搞个 docker ?

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Nov 17, 2017

Contributor

因为有需求是用ffi调用win32的dll(比如身份证、银行卡读卡),得是win系统。 如果有linux下的通用读卡链接库并且docker可以访问宿主机usb接口的读卡机具那就不这么费事了啊。

Contributor

waitingsong commented Nov 17, 2017

因为有需求是用ffi调用win32的dll(比如身份证、银行卡读卡),得是win系统。 如果有linux下的通用读卡链接库并且docker可以访问宿主机usb接口的读卡机具那就不这么费事了啊。

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Mar 29, 2018

Contributor

@atian25
我用TS实现扩展框架,其中 class Application extends egg.Application 报错

无法实现接口,你的意思是‘实施’吗”?

i18翻译有问题,原意应该是

无法 extends interface, 是否应该使用 implements interface

egg/index.js 其中导出了 BaseContextClass, index.d.ts 文件中有 class BaseContextClass 的定义。而前者也导出了 Application 模块,而在后者中只有导出导出 interface Application 接口但没有 类的定义。
能否修改 https://github.com/eggjs/egg/blob/master/index.d.ts 增加 class Applicate 定义,然后 PR?

Contributor

waitingsong commented Mar 29, 2018

@atian25
我用TS实现扩展框架,其中 class Application extends egg.Application 报错

无法实现接口,你的意思是‘实施’吗”?

i18翻译有问题,原意应该是

无法 extends interface, 是否应该使用 implements interface

egg/index.js 其中导出了 BaseContextClass, index.d.ts 文件中有 class BaseContextClass 的定义。而前者也导出了 Application 模块,而在后者中只有导出导出 interface Application 接口但没有 类的定义。
能否修改 https://github.com/eggjs/egg/blob/master/index.d.ts 增加 class Applicate 定义,然后 PR?

@whxaxes

This comment has been minimized.

Show comment
Hide comment
@whxaxes

whxaxes Mar 29, 2018

Member

@waitingsong 没看懂你想表达什么?你发一下你的代码看看?

Member

whxaxes commented Mar 29, 2018

@waitingsong 没看懂你想表达什么?你发一下你的代码看看?

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Mar 29, 2018

Contributor

按照 文档 来扩展

网络有问题,截图上传错误。。

Contributor

waitingsong commented Mar 29, 2018

按照 文档 来扩展

网络有问题,截图上传错误。。

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong
Contributor

waitingsong commented Mar 29, 2018

2018-03-29_170036

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Mar 29, 2018

Contributor

按照当前 egg/index.d.ts , 导出的 Application 是个接口,所以TS就不能用 extends 来继承接口(本意是继承类)

Contributor

waitingsong commented Mar 29, 2018

按照当前 egg/index.d.ts , 导出的 Application 是个接口,所以TS就不能用 extends 来继承接口(本意是继承类)

@atian25

This comment has been minimized.

Show comment
Hide comment
@atian25

atian25 Mar 29, 2018

Member

这个问题跟 PR 有什么关系?
新起 issue 吧

Member

atian25 commented Mar 29, 2018

这个问题跟 PR 有什么关系?
新起 issue 吧

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Mar 29, 2018

Contributor

我的意思是我克隆 egg 然后修改 index.d.ts 增加 class Application 定义,然后提交 PR 这样行不

Contributor

waitingsong commented Mar 29, 2018

我的意思是我克隆 egg 然后修改 index.d.ts 增加 class Application 定义,然后提交 PR 这样行不

waitingsong added a commit to waitingsong/egg that referenced this pull request Mar 30, 2018

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Mar 30, 2018

Contributor

@atian25
startCluster(options, callback) 的回调方法能否在出口参数包含进程的对象或者pid呢?

2018-03-30_115013

Contributor

waitingsong commented Mar 30, 2018

@atian25
startCluster(options, callback) 的回调方法能否在出口参数包含进程的对象或者pid呢?

2018-03-30_115013

@atian25

This comment has been minimized.

Show comment
Hide comment
@atian25

atian25 Mar 30, 2018

Member

@waitingsong 跟这个 PR 没有关系的问题,不建议在这里讨论,很容易被忽略掉的。

能执行这个 callback 的进程,跟 startCluster 不就是一个进程么,你直接拿就好了。
如果你是想拿 worker 和 agent 的进程,可以看下 egg-cluster 源码,我记得有一个事件广播的

Member

atian25 commented Mar 30, 2018

@waitingsong 跟这个 PR 没有关系的问题,不建议在这里讨论,很容易被忽略掉的。

能执行这个 callback 的进程,跟 startCluster 不就是一个进程么,你直接拿就好了。
如果你是想拿 worker 和 agent 的进程,可以看下 egg-cluster 源码,我记得有一个事件广播的

@waitingsong

This comment has been minimized.

Show comment
Hide comment
@waitingsong

waitingsong Mar 30, 2018

Contributor

cluster 这个仓库没issue, 没找到哪儿适合提需求。就只好在这儿跟帖了。。。
我再去看看源码

Contributor

waitingsong commented Mar 30, 2018

cluster 这个仓库没issue, 没找到哪儿适合提需求。就只好在这儿跟帖了。。。
我再去看看源码

@atian25

This comment has been minimized.

Show comment
Hide comment
@atian25

atian25 Mar 30, 2018

Member

统一在 egg 那边啊

Member

atian25 commented Mar 30, 2018

统一在 egg 那边啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment