Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback fuction not defined in nodejs - chmod inside linux.js(Version - 1.1.11) #52

Open
Piyush5767 opened this issue Dec 11, 2020 · 1 comment

Comments

@Piyush5767
Copy link

Piyush5767 commented Dec 11, 2020

Received error while relaunches the downloaded release

The linux.js(nw-autoupdater/Lib/Swap/Linux.js) Library - extract function is using Nodejs chmod function whereas the call back function is not defined and the script is generating a type error.

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined
    at makeCallback (fs.js:161:11)
    at Object.chmod (fs.js:1218:14)
    at SwapLinux.extractScript (/tmp/.io.nwjs.islKfA/node_modules/nw-autoupdater/Lib/Swap/Linux.js:19:8)

We are receiving the error when nw-autoupdater is trying to restart the node WebKit application after its downloads and installed the files from the server. Also, this issue appears only in linux OS for Windows it's working fine. For the reference below I have defined the extract function which is used by linux.js

  extractScript( homeDir )
  {
    let content = this.getScriptContent() + `
echo " "
echo "$APP_PATH/\${RUNNER}&"
"$APP_PATH/\${RUNNER}"&`,
        scriptPath = join( homeDir, "swap.sh" );
    fs.writeFileSync( scriptPath, content, "utf8" );
    fs.chmod( scriptPath, 511 ); // 755
    this.scriptPath = scriptPath;
  }

@Piyush5767
Copy link
Author

Piyush5767 commented Dec 11, 2020

Adding callback fixes the type error and installed the files, whereas It is still not able to load the application in Linux.

 fs.chmod( scriptPath, 0o775,(err) => {
    if (err) throw err;
 });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant