import 'express';
import 'socket.io';
import deasync from 'deasync';
import cp from 'child_process';
console.log(deasync(cp.exec)('ls -la'));
Looking through the other issues I have not been able to find any other reports of this error. Digging around elsewhere, this seems to be coming from some low level C area, but that is beyond me.
It only occurs with ES6 modules, using commonjs' require works fine. It also only occurs when I import both socket.io and express, commenting out either import allows the deasync call to run. Furthermore, not every module causes this. Of those I tested only these 2 cause the bug to occur, which I'd imagine has something to do with their dependencies.
But the plot thickens, if you wrap the deasync call in a setTimeout, even of 0ms, it runs fine. This of course defeats the entire purpose of deasync, but I had a sneaky suspicion this would work and to me it indicates a deeper origin of the issue within Node's execution scheduling.
Environment:
deasync: v0.1.29
node: v20.10.0
OS: Ubuntu 22.04
architecture: x86_64
I'm not really expecting a solution that will allow me to use deasync for my project but I thought I'd post this here as it appears to be indicative of a much deeper problem. Love the idea of deasync by the way!
Receiving this error whilst trying to run the example from the main readme.
Here is the minimum code to reproduce:
Looking through the other issues I have not been able to find any other reports of this error. Digging around elsewhere, this seems to be coming from some low level C area, but that is beyond me.
It only occurs with ES6 modules, using commonjs' require works fine. It also only occurs when I import both socket.io and express, commenting out either import allows the deasync call to run. Furthermore, not every module causes this. Of those I tested only these 2 cause the bug to occur, which I'd imagine has something to do with their dependencies.
But the plot thickens, if you wrap the deasync call in a setTimeout, even of 0ms, it runs fine. This of course defeats the entire purpose of deasync, but I had a sneaky suspicion this would work and to me it indicates a deeper origin of the issue within Node's execution scheduling.
Environment:
I'm not really expecting a solution that will allow me to use deasync for my project but I thought I'd post this here as it appears to be indicative of a much deeper problem. Love the idea of deasync by the way!