You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a server, you should not use the following synchronous APIs from these modules:
...
Child process:
child_process.spawnSync
...
here is a promise example of spawn API
import{spawn}from'child_process';// *** Not async
export defaultfunctionclone(options: { url: string; path: string;}){// *** Return the promisereturnnewPromise(function(resolve,reject){consturl=options.url;consttarget=options.path;constargs=['clone',url,target];constprocess=spawn('git',args);process.on('close',function(code){// Should probably be 'exit', not 'close'// *** Process completedresolve(code);});process.on('error',function(err){// *** Process creation failedreject(err);});});}
The text was updated successfully, but these errors were encountered:
trim21
changed the title
spawnAsync is blockspawnAsync blocks
Jun 26, 2021
flood/server/util/diskUsageUtil.ts
Lines 7 to 14 in 5e6d5c3
this didn't do anything
Async
,spawnSync
will block event loop when executing this command.ref:
https://nodejs.org/en/docs/guides/dont-block-the-event-loop/
here is a promise example of
spawn
APIThe text was updated successfully, but these errors were encountered: