Skip to content

Conversation

@Ptival
Copy link
Contributor

@Ptival Ptival commented Oct 21, 2015

Hello,

Working on NixOS, it is extremely bad that atom-typescript overwrites the environment of the process when calling spawn.
In particular, the child process fails to spawn as it cannot find libgtk-x11.

This patch attempts to solve this issue by only overriding the existing environment.

What is the policy with regards to pull requests? I notice the dist/ repository is tracked, which is weird, but I guess it's useful for bootstrapping?

Best regards,

@basarat basarat self-assigned this Oct 22, 2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues:

a.) You are mutating process.env here ... that is bad
b.) Using process.env as a whole breaks using atom as node on windows. See : atom/atom#2887 (comment) and independently verified : atom/atom#2887 (comment)

Solutions :

  • Use Object.create around process.env
  • only do if platform is NixOS

Thanks for finding the bug 🌹

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, oops! I will fix that.

Do you have an existing way of checking the operating system?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an existing way of checking the operating system?

process.platform https://nodejs.org/api/process.html#process_process_platform although I don't know the value for NixOS .... I'd be okay with whatever that is as long as its not mac / windows :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has value 'linux' under NixOS.
I can set it that way, though I am not able to test on many such operating systems.

@basarat
Copy link
Member

basarat commented Oct 22, 2015

What is the policy with regards to pull requests? I notice the dist/ repository is tracked, which is weird, but I guess it's useful for bootstrapping?

Its because atom packages are git tags ... and if the .js resources aren't there in github package will not work :-/ :rose:

basarat added a commit that referenced this pull request Oct 22, 2015
workerLib's spawn should preserve the environment
@basarat basarat merged commit 9ba9169 into TypeStrong:master Oct 22, 2015
basarat added a commit that referenced this pull request Oct 22, 2015
@basarat
Copy link
Member

basarat commented Oct 22, 2015

Released as a minor update : https://github.com/TypeStrong/atom-typescript/releases/tag/v7.5.0 🌹

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants