Hacker News new | ask | show | jobs
by davidt84 478 days ago
I'm very confused here, the argument is just JavaScript code... What is passing that argument?

Assuming that JavaScript is evaluated but the launched process, that will serialise the entire environment -- which is passed to every process anyway.

1 comments

I'm confused too :). The LuLu alert says [0]:

    process id: 54279
    process args: -p "<some id>" + JSON. stringify(process.env) + "<some id>"
    process path: /Applications/Cursor.app
The alert showed up right after I installed the app and clicked on the Cursor icon [1]. I understand that processes can access the entire environment by default (which was always a bit too "open"/strange for my taste, but I get the reason) but then I don't understand why you need to use `JSON. stringify(process.env)`

[0] <some id> was some 12 character hex string

[1] Note that this was like a month ago; I have a cold, so finally have time to catch up on such questions

I know nothing about how Cursor is implemented, so this may be wildly off base, but...

Perhaps it is written using some kind of JavaScript framework that doesn't allow access to the process environment by default, but this lets them work around that to access the environment like a native app?

One reason you'd want an IDE to have access to your environment is to enable any tools/compilers/whatever you launch from the IDE to inherit the environment (say, to access SSH_AGENT_SOCK, or whatever).

Ok, this sounds like a plausible direction — thanks!

It seems that Cursor is using Electron. I don't know about its internals (tried it a couple of times years ago), but after a quick look at the docs I've found this: https://www.electronjs.org/docs/latest/api/utility-process#u... which is a section describing `utilityProcess.fork(modulePath[, args][, options])`:

    env Object (optional) - Environment key-value pairs. Default is process.env.
I don't get why some unique-looking prefix/suffix would be needed there, though.