Skip to content

Commit

Permalink
Fix argument passing in the Task class
Browse files Browse the repository at this point in the history
This code snippet sets up logging so that a worker process can call `console.log` and its siblings and have them show up in the renderer process’s console… but it’s trying to destructure the antiquated magical `arguments` collection (which is like an array, but isn’t an array!) and the engine doesn’t seem to like it.

Logging didn’t work for me until I changed this.

This is such a tiny fix, and I don’t have the energy to shelve everything on this branch just to make a separate PR.
  • Loading branch information
savetheclocktower committed Feb 3, 2024
1 parent 3131464 commit 5628d08
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ module.exports = class Task {
const env = Object.assign({}, process.env, {userAgent: navigator.userAgent});
this.childProcess = ChildProcess.fork(require.resolve('./task-bootstrap'), [compileCachePath, taskPath], { env, silent: true});

this.on("task:log", () => console.log(...arguments));
this.on("task:warn", () => console.warn(...arguments));
this.on("task:error", () => console.error(...arguments));
this.on("task:log", (...args) => console.log(...args) );
this.on("task:warn", (...args) => console.warn(...args) );
this.on("task:error", (...args) => console.error(...args));

this.on("task:deprecations", (deprecations) => {
for (let i = 0; i < deprecations.length; i++) {
Expand Down Expand Up @@ -157,7 +157,7 @@ module.exports = class Task {
}

once(eventName, callback) {
var disposable = this.on(eventName, function(...args) {
var disposable = this.on(eventName, function (...args) {
disposable.dispose();
callback(...args);
});
Expand Down

0 comments on commit 5628d08

Please sign in to comment.