Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ export class PowerJS {
}, 8000);
}

#findOptimalShell(additionalShellNames) {
#findOptimalShell(additionalShellNames, shellArgs, options) {
// Find optimal shell
for (const sname of additionalShellNames) {
try {
this.#child = spawn(sname);
this.#child = spawn(sname, shellArgs, options);
this.#shell = sname;
break;
} catch (e) {
Expand Down Expand Up @@ -245,6 +245,8 @@ export class PowerJS {
autoStart = true,
extensions = [],
dlls = {},
shellArgs = [],
options = {},
} = {}) {
additionalShellNames.push("pwsh", "powershell");

Expand All @@ -255,7 +257,7 @@ export class PowerJS {
}
}

this.#findOptimalShell(additionalShellNames);
this.#findOptimalShell(additionalShellNames, shellArgs, options);
if (this.#child == null) {
throw new Error(
"Cannot find a powershell interpreter! Try installing powershell or adding your one!"
Expand Down