-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Truffle console: Assignments involving an await return undefined #3349
Comments
@haltman-at , It looks like the result of the global variable cleanup for our top-level await workaround. That |
So now that the problem has finally been identified, the question is whether to use a targeted fix that just fixes this, or, since we no longer support Node 8, to just rewrite all this to use |
|
I would love to get rid of the parsing done on the Truffle side to deal with |
Unfortunately, there's no way of doing |
Damn. OK, I guess targeted solution it'll have to be then, and #1546 will just remain open... |
actually, this may not be true @gnidan . I just ran a test and it works for v10, 12, & 14 |
@cds-amal, I think that statement needs some elaboration! What Amal actually did is not to somehow pass the equivalent of the It's a little unclear whether this suffices for our purposes, but it just might... after all, it's not like we create a REPL from any other package! |
@haltman-at you're correct. The outer node process receives the |
Oh, so it doesn't work after all? Damn, that's disappointing... |
Btw, apparently as of Node 16, |
This is still an issue, is there any way to be able to use the the truffle console? From what i'm reading... i think truffle console is pretty much half pointless at the moment? Or, am i reading this wrong |
Check out Filip's use of truffle console in this video series |
Thank you for the video, I had to watch it a second time, as the first, I was skipping through instead of fully watching the last part of it. Absolutely solved the issue I was having. |
Fixed in pull#5270 and in the latest release v5.5.22. Thanks @haltman-at! |
Issue
In Truffle Console, if you enter an assignment expression, and the right-hand-side involves an
await
, the return value incorrectly shows asundefined
.Both the assignment and the
await
seems to be necessary. For instance, bothx = 3
andawait 3
correctly show3
; however,x = await 3
showsundefined
.This also happens in more complicated assignments involving
await
, such asx = (await 3) + 1
. Of course, note that more complicated expressions like this may not work at all, as per #1546! Indeed I assume this issue is probably related to #1546 somehow... (but maybe it's easier to fix? IDK).Steps to Reproduce
Open
truffle console
in a Truffle project.Enter:
x = await 3
x = (await 3) + 1
Expected Behavior
The return values should be
3
and4
, respectively.Actual Results
The return values are both
undefined
.Environment
truffle version
): 5.1.41node --version
): v10.15.3npm --version
): 6.14.5The text was updated successfully, but these errors were encountered: