Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Messages to workers #879

Closed
Closed
@ocombe

Description

I was trying to communicate between the workers and the master in my brunch plugin, and it triggered an error in brunch.
The problem is that you listen to all messages from the workers without using a namespace (in the initWorker function and you assume that the workers will only send a path:

initWorker = ({changeFileList, compilers, linters, fileList}) ->
  fileList.on 'compiled', (path) ->
    process.send fileList.files.filter (_) -> _.path is path
  process
    .on 'message', (path) ->
      changeFileList compilers, linters, fileList, path
    .send 'ready'

The error is the following:

TypeError: Object # has no method 'match'
at FileList.module.exports.FileList.isIgnored (C:\wamp\www\myProject\node_modules\brunch\lib\fs_utils\file_list.js:76:23)
at C:\wamp\www\myProject\node_modules\brunch\lib\fs_utils\file_list.js:84:28
at Array.some (native)
at FileList.module.exports.FileList.isIgnored (C:\wamp\www\myProject\node_modules\brunch\lib\fs_utils\file_list.js:82:23)
at FileList.module.exports.FileList._change (C:\wamp\www\myProject\node_modules\brunch\lib\fs_utils\file_list.js:216:22)
at FileList._change (C:\wamp\www\myProject\node_modules\brunch\lib\fs_utils\file_list.js:5:61)
at FileList.EventEmitter.emit (events.js:106:17)
at changeFileList (C:\wamp\www\myProject\node_modules\brunch\lib\watch.js:194:21)
at process. (C:\wamp\www\myProject\node_modules\brunch\lib\worker.js:49:14)
at process.EventEmitter.emit (events.js:117:20)
at handleMessage (child_process.js:322:10)
at Pipe.channel.onread (child_process.js:349:11)

Could you add a namespace or some kind of test to avoid this error please ?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions