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

If i append args to autostart.opts.appPath the finally generate command is incorrect #116

Closed
ghost opened this issue Sep 13, 2023 · 1 comment · Fixed by #126
Closed
Labels

Comments

@ghost
Copy link

ghost commented Sep 13, 2023

var appAutoLaunch = new AutoLaunch({ name: 'App',isHidden:true });
appAutoLaunch.isEnabled().then(function (isEnabled){
    if(!isEnabled){
        appAutoLaunch.opts.appPath += ` "${__filename}" "--autostart" `;
        appAutoLaunch.enable();
    }
    console.log(arguments,appAutoLaunch.opts,__filename);
});

In windows register table added command is "D:\project\vue2\node_modules\electron\dist\electron.exe "D:\project\vue2\desktop.js" "--autostart""
System will treat command arguments as part of executable file path

@ghost ghost changed the title I if append args to autostart.opts.appPath the finally generate command is incorrect If i append args to autostart.opts.appPath the finally generate command is incorrect Sep 13, 2023
@Oxalin
Copy link
Contributor

Oxalin commented Dec 3, 2023

Args are not supported in that way. Electron apps use "--process-start-args" before the args that need to be forwarded to the process to be run.

Is your problem specific to the "autostart" in your example or do you want to use other arguments? Because "--autostart" to be the same as the purpose of auto-launch (to add an entry for launch at startup).

Other arguments should be read at process launch from a config/preference file.

@Oxalin Oxalin added the invalid label Dec 4, 2023
@Oxalin Oxalin closed this as completed Dec 4, 2023
@Oxalin Oxalin linked a pull request Mar 22, 2024 that will close this issue
@Oxalin Oxalin linked a pull request Apr 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant