Skip to content

Commit 0c64306

Browse files
committed
Add comment on Proxy usage
1 parent bdbbe6a commit 0c64306

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/flow-control/kill-on-signal.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export class KillOnSignal implements FlowController {
3232
return { ...exitInfo, exitCode };
3333
}),
3434
);
35+
// Return a proxy so that mutations happen on the original Command object.
36+
// If either `Object.assign()` or `Object.create()` were used, it'd be hard to
37+
// reflect the mutations on Command objects referenced by previous flow controllers.
3538
return new Proxy(command, {
3639
get(target, prop: keyof Command) {
3740
return prop === 'close' ? closeStream : target[prop];

src/flow-control/restart-process.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ export class RestartProcess implements FlowController {
7979
}),
8080
);
8181

82+
// Return a proxy so that mutations happen on the original Command object.
83+
// If either `Object.assign()` or `Object.create()` were used, it'd be hard to
84+
// reflect the mutations on Command objects referenced by previous flow controllers.
8285
return new Proxy(command, {
8386
get(target, prop: keyof Command) {
8487
return prop === 'close' ? closeStream : target[prop];

0 commit comments

Comments
 (0)