How to exec in NodeJS using the user's environment?

后端 未结 1 1329
没有蜡笔的小新
没有蜡笔的小新 2021-02-08 06:33

I am trying to execute a command in Node:

cd \"/www/foo/\" && \"/path/to/git/bin/git.exe\" config --list --global

Basically, I want to

1条回答
  •  盖世英雄少女心
    2021-02-08 06:43

    I solved it.

    I retrieved the current environment from process.env and extended it with my own properties:

    var environment = process.env;
    environment.customProp = 'foo';
    
    var config = {
        maxBuffer: 10000 * 1024,
        env: environment
    };
    

    So the problem was I missed the entire environment when I overwrote it.

    0 讨论(0)
提交回复
热议问题