Truffle console: Assignments involving an await return undefined
See original GitHub issueIssue
In Truffle Console, if you enter an assignment expression, and the right-hand-side involves an await
, the return value incorrectly shows as undefined
.
Both the assignment and the await
seems to be necessary. For instance, both x = 3
and await 3
correctly show 3
; however, x = await 3
shows undefined
.
This also happens in more complicated assignments involving await
, such as x = (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
and 4
, respectively.
Actual Results
The return values are both undefined
.
Environment
- Operating System: Release Linux Mint 20 Ulyana 64-bit
- Ethereum client: Ganache CLI v6.10.1 (ganache-core: 2.11.2)
- Truffle version (
truffle version
): 5.1.41 - node version (
node --version
): v10.15.3 - npm version (
npm --version
): 6.14.5
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:15 (13 by maintainers)
Top GitHub Comments
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.
@cds-amal, I think that statement needs some elaboration!
What Amal actually did is not to somehow pass the equivalent of the
--experimental-repl-await
flag to therepl
library, but rather to pass the actual--experimental-repl-await
flag to the instance of Node that’s running Truffle! That is to say, we could add it to the shebang line in@truffle/core
!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!