2014년 12월 4일 목요일

does node actually use process.config.variables?

I've looked at process.config which is like this in my environment: 

{ target_defaults:
   { cflags: [],
     default_configuration: 'Release',
     defines: [],
     include_dirs: [],
     libraries:
      [ '-lz',
        '-lcares',
        '-lv8',
        '-lssl',
        '-lcrypto' ] },
  variables:
   { clang: 0,
     gcc_version: 49,
     host_arch: 'x64',
     node_install_npm: false,
     node_prefix: '/usr',
     node_shared_cares: true,
     node_shared_http_parser: false,
     node_shared_libuv: false,
     node_shared_openssl: true,
     node_shared_v8: true,
     node_shared_zlib: true,
     node_tag: '',
     node_unsafe_optimizations: 0,
     node_use_dtrace: false,
     node_use_etw: false,
     node_use_openssl: true,
     node_use_perfctr: false,
     node_use_systemtap: false,
     python: '/usr/bin/python',
     target_arch: 'x64',
     v8_enable_gdbjit: 0,
     v8_no_strict_aliasing: 1,
     v8_use_snapshot: false } }

And looking at this I wondered: Does node (during runtime!) acknowledge that you've change something there? Such as adding the key and value:

    process.conf.variables.node_use_idle_notification = false

Does node care about changes like this? Are there viable reasons to NOT do this?



The documentation says this is "An Object containing the JavaScript representation of the configure options that were used to compile the current node executable"

http://nodejs.org/api/process.html#process_process_config

As such I would assume it is treated as read-only, or that if you are able to make any changes to it, it would be pointless and confusing to do so since it would have no effect.



process.config is a copy of config.gypi, baked into the binary at
compile time.  That file is created by ./configure and contains build
time flags.  As such, mutating process.config does absolutely nothing.



Ah too bad. Is there another way to modify the runtime env during runtime? Another I could imagine 
would be adding to process.env but (not having looked at the code at all) node will only check for 
that during runtime initialization.

I can see good reason why and why not to do this but just wether or not thats possible at all is the question



> Ah too bad. Is there another way to modify the runtime env during runtime?
What do you mean by runtime env? What do you want to modify? Most
things in process.config (all?) are immutable: you can't change the
gcc version node was compiled with.



I was wondering if setting flags such as --nouse-idle-notification and v8 
options that you can set from the commandline was possible from inside the node process.



> I was wondering if setting flags such as --nouse-idle-notification and v8
> options that you can set from the commandline was possible from inside
> the node process.
--nouse_idle_notification is a no-op in v0.10 and newer.  That said,
the ability to change V8 settings on the fly has merit:
https://github.com/node-forward/node/pull/62



The node repo for node-forward doesn't exist for me I'm not a contributor (yet -- maybe soon). So I can't see if you have a private repo in the Organisation or anythin.

If you have I'd be interested though ;)



> The node repo for node-forward doesn't exist for me I'm not a contributor
> (yet -- maybe soon). So I can't see if you have a private repo in the
> Organisation or anythin.
>
> If you have I'd be interested though ;)
>
> Cheers,
>
> Andreas Marschke.
What's your GitHub nick, Andreas?  The repository is private for now
but I can add you if you want.



That'd  be `andreas-marschke`




> That'd  be `andreas-marschke`
>
> See also: https://github.com/andreas-marschke
>
> Thanks!
Invite's in your inbox, Andreas.


댓글 없음:

댓글 쓰기