-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Run each console command in its own child process #3319
Conversation
…me warnings we already saw in the parent
…ild process, and add comments
Set context vars
@@ -40,26 +40,34 @@ module.exports = { | |||
"@truffle/core", | |||
"index.js" | |||
), | |||
consoleChild: path.join( |
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.
Just out of curiosity, why do we need to create a bundle for this? I guess it's because Truffle needs to use an external bundle to run the command in a separate process? It seems like this will drastically increase the size of the stuff we need to include with Truffle, huh?
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.
The reason we have to create a bundle is to ensure that the console-child.js
file can be properly accessed from the build version of truffle when I try to run it with the spawn. It's really just a path issue. Does that make sense?
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.
I'm understanding that the bundle will be running this other bundle using the user's input. Yeah? This will make the distributed files a lot larger, right? I'm not trying to hold this PR up, I'm just curious.
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.
I'm not sure I follow. The file being bundled is console-child.js
, which is fairly short. The cli.bundled.js
file is a tiny bit bigger -- 22.842243 megabytes on develop
and 22.843334 megabytes on this branch. I don't think that's particularly significant?
More to the point though, how else would you get the correct path here?
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.
Yes, but console-child.js
is just the entry point. So it will probably almost double the size of the distributed stuff for Truffle. Essentially this is the same size as cli.bundled.js
...which might be ok. I just wanted to point out that this seems to be a significant increase in size. Does that make sense?
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.
Well I checked and it is not quite double, it increases the stuff in the build folder from ~50MB to like ~72MB. Something like that.
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.
Hm, yeah I think that makes sense but I don't think there's another way. The whole point is that we can run Truffle commands through the child process. So we need all of that bundled this way. If you have a suggestion for how to reduce the distributed code size I'm happy to discuss further!
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.
No it's probably fine. I just wanted to bring it up as something we should be aware of :)
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.
Yeah, let's avoid having that bundle in two places :)
So we decided that the best fix here would be to define an entry point at |
…ng on the context
Bundle commands separately
}); | ||
} | ||
|
||
runSpawn(inputStrings, options, callback) { |
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.
We should rewrite this method to not take a callback. This does not hold up this PR from being merged, I just wanted to note that here.
@@ -321,7 +310,7 @@ class DebugInterpreter { | |||
|
|||
//quit if that's what we were given | |||
if (cmd === "q") { | |||
return await util.promisify(this.repl.stop.bind(this.repl))(); | |||
process.exit(); |
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.
We should also eventually set the exit code here, no? Again, I don't think this should hold this PR up.
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.
I like it!
Reverts #3314
We have a fix for this now, so we can revert the reversion and put in the fix, which is in #3317.
Original PR description: