title: How to lie to program about `process.platform`?
body: <p>There is a CLI that runs on Node and can be executed via <code>command</code> on the command line. In its code, some functionality is deactivated for Windows users by <code>if (process.platform === 'win32') { process.exit(1); }</code>. Now I want to disable this check, and allow Windows users to use the "hidden" functionality (usually the the required software is not installed on Windows, but I have a special setup where it is).</p>
  
  <p>Is there some way, to lie to this CLI and simulate that it is running on e.g. Linux or macOS?</p>
  
  <p>Of course I could fork the CLI, remove the check and work with my own version - but this would require repeating this process for each release. As this functionality should also be available to other users, I would have to publish the forked and modified CLI which could be a frequent source of confusion for its users (What about version numbers? Do I use the same <code>command</code>?) - 99.9% of the code will stay untouched.</p>
  
  <p>Could I maybe write my own CLI, that does something to "fake" the environment, then executes the installed, original CLI, and cleans up afterwards?</p>
  
  <hr>
  
  <p>I created an example package that works identical to the CLI, but only does exactly that part that I am investigating:</p>
  
  <ul>
  <li><a href="https://github.com/janpio/nodejs-cli-nowin" rel="noreferrer">https://github.com/janpio/nodejs-cli-nowin</a></li>
  <li><a href="https://www.npmjs.com/package/nodejs-cli-nowin" rel="noreferrer">https://www.npmjs.com/package/nodejs-cli-nowin</a> </li>
  </ul>
  
  <p>Install via <code>npm i -g nodejs-cli-nowin</code>.</p>