ITADN

Allow arguments and options to be passed to child process spawn

#11Pull RequestIsaacUtah1379 创建于 2025-01-01
I
IsaacUtah1379commented
The current implementation does not allow specifying any arguments or options to pass to `child_process.spawn` when creating a new instance of `PowerJS`. This pull request modifies the constructor of `PowerJS` to accept optional `shellArgs` and `options` in the object of options passed to the constructor. These are then passed to the `args` and `options` arguments of `child_process.spawn`, respectively. If `shellArgs` and/or `options` is not passed to the constructor of `PowerJS`, then it is ignored, as per the current implementation. Uses include passing flags to the initial invocation of PowerShell ([available flags](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_exe?view=powershell-5.1)) and passing options that affect the child process itself, such as the current working directory or environment variables for the child process. Closes #8 since `-NoProfile` can be one of the arguments passed with `shellArgs`.
合并状态:未合并 0 条评论