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

Suggestion: optional executable path #48

Open
joaisa17 opened this issue Jul 1, 2022 · 0 comments
Open

Suggestion: optional executable path #48

joaisa17 opened this issue Jul 1, 2022 · 0 comments

Comments

@joaisa17
Copy link

joaisa17 commented Jul 1, 2022

On my dedicated server build, I occasionally need to run multiple versions of Java at the same time. To run the latest version of java, this library does the job, but when I want to run java8 for modded servers, I need to specify where the java executible is.

I would suggest adding a executable option, with the default value of java to the javaserver config, and then implementing it in the start function.

Current

export class JavaServer extends EventsEmitter {
  // ...
  public start() {
    if (this.process) {
      throw new Error('JavaServer already running');
    }

    this.process = spawn('java', [...this.config.javaServer.args, '-jar', this.config.javaServer.jar, 'nogui'], {
      cwd: this.config.javaServer.path,
      stdio: ['pipe', 'pipe', 'pipe'],
    });
    //...
  }
}

Suggested

export class JavaServer extends EventsEmitter {
  // ...
  public start() {
    if (this.process) {
      throw new Error('JavaServer already running');
    }

    this.process = spawn(this.config.javaServer.executable, [...this.config.javaServer.args, '-jar', this.config.javaServer.jar, 'nogui'], {
      cwd: this.config.javaServer.path,
      stdio: ['pipe', 'pipe', 'pipe'],
    });
    //...
  }
}
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