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

shell.exec('export NODE_OPTIONS=--max-old-space-size=4096') doesn't work #980

Closed
ihaichao opened this issue Dec 10, 2019 · 1 comment
Closed
Labels
question Question from a user (which may not require code/documentation changes to the project) wontfix

Comments

@ihaichao
Copy link

Node version (or tell us if you're using electron or some other framework):

v10.15.0

ShellJS version (the most recent version/Github branch you see the bug on):

0.8.3

Operating system:

macOS Mojave 10.14.6

Description of the bug:

shell.exec('export NODE_OPTIONS=--max-old-space-size=4096') should set the max memory for Node to 4096, but it doesn't work

Example ShellJS command to reproduce the error:

import shell from 'shelljs';
import v8 from 'v8'

if (shell.exec('export NODE_OPTIONS=--max-old-space-size=4096').code !== 0) {
  shell.exit(1);
}

const validSize = v8.getHeapStatistics().total_available_size / 1024 / 1024

console.log(validSize)
@nfischer
Copy link
Member

Try shell.env.NODE_OPTIONS = '--max-old-space-size=4096' instead. However, I'm not sure node supports setting this variable after startup (but that's out of the scope of ShellJS).

@nfischer nfischer added question Question from a user (which may not require code/documentation changes to the project) wontfix labels Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question from a user (which may not require code/documentation changes to the project) wontfix
Projects
None yet
Development

No branches or pull requests

2 participants