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

meow does something strange with GL #144

Closed
mifi opened this issue Apr 12, 2020 · 7 comments
Closed

meow does something strange with GL #144

mifi opened this issue Apr 12, 2020 · 7 comments

Comments

@mifi
Copy link

mifi commented Apr 12, 2020

I create a new directory then yarn add gl meow

const GL = require('gl');
const meow = require('meow');

// meow('foo');

const gl = GL(800, 600);
console.log(gl != null);

This prints true - all ok.

However when I uncomment meow('foo'), I get false. So for some reason GL returns null now. Will look more into it, but maybe you have an idea. Is meow doing any global changes to the node environment?

@sindresorhus
Copy link
Owner

The only thing I can think of is

meow/index.js

Lines 13 to 15 in 2954ed2

// Prevent caching of this module so module.parent is always accurate
delete require.cache[__filename];
const parentDir = path.dirname(module.parent.filename);
. Try commenting that out.

@mifi
Copy link
Author

mifi commented Apr 13, 2020

I tried to comment out the "delete" line, didn't help

@papb
Copy link

papb commented Apr 13, 2020

Hello, I happen to watch this repository and this issue surprised me. I tried to reproduce it but could not. I got true as output in both cases. The only difference is that I used npm instead of yarn.

EDIT: used yarn, still getting true in both cases.

@mifi
Copy link
Author

mifi commented Apr 13, 2020

I did some binary search code elimination and I found that what's causing it is this line:

meow/index.js

Line 80 in 2954ed2

process.title = pkg.bin ? Object.keys(pkg.bin)[0] : pkg.name;

@papb which OS are you on?

So basically the way to reproduce this is:

const GL = require('gl');

process.title = 'foo'

const gl = GL(320, 240);
console.log(gl != null)

Returns false

If I comment out process.title = 'foo', returns true

@mifi
Copy link
Author

mifi commented Apr 13, 2020

Now I found this issue: stackgl/headless-gl#180

@mifi
Copy link
Author

mifi commented Apr 13, 2020

As suggested there I upgraded to node v12.16.2 and now it works. I was running v12.11.1 before.

@mifi mifi closed this as completed Apr 13, 2020
@papb
Copy link

papb commented Apr 13, 2020

I am on windows, node v12.14.1

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

3 participants