Answer the question
In order to leave comments, you need to log in
Why won't the game's exe file launch?
Good day. I'm trying to write a launcher for an Electron game. Here is the code:
const child = exec('C:/Games/папка игры/что-то там.lnk', callback);
const child = exec('C:/Games/папка игры/что-то там.exe', callback)
, then the game tries to start, but after a couple of seconds the window closes. Exit event listener on child after exit writeschild process exited with code 3221225477 and signal null
Error: Command failed: C:\Games\папка игры\что-то там.exe
at ChildProcess.exithandler (child_process.js:308)
at ChildProcess.emit (events.js:203)
at maybeClose (internal/child_process.js:1021)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283)
and that's it, nothing else interesting. execFile, spawn instead of exec don't work. It's just that programs (excel, calc, cmd) are launched via exe and work, but games do not. Answer the question
In order to leave comments, you need to log in
the problem is in the
cwd parameter (working directory)
https://nodejs.org/dist/latest-v12.x/docs/api/chil...
by default as the folder containing the specified .exe
In node, by default, this parameter is taken from process.cwd()
https://nodejs.org/dist/latest-v12.x/docs/api/proc...
which corresponds to the working directory of your process node
I don't fully understand what it is forit specifies the "working directory of the process", all relative paths used in the program being run will be calculated relative to this directory
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question