Skip to content

Commit

Permalink
Fix command line is too long with Powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
TURMEL Kevin committed May 6, 2022
1 parent 8923d4a commit c25fa7b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Bug fixes

- **Fallout 4 support**
- "Command line is too long" error should occur less by using Powershell. Powershell is installed by default starting with Windows 7.
- When closing the drawer panel, links could break into multiple lines
- Duplicated logs entry
- Changelog window correctly displays images
Expand Down
5 changes: 4 additions & 1 deletion src/main/command/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ export function executeCommand(
): Promise<{ stdout: string; stderr: string }> {
logger.debug('running the command', cmd, 'in the folder', cwd)

return exec(cmd, { cwd, shell: is.windows ? 'powershell' : undefined })
return exec(`${is.windows ? '& ' : ''}${cmd}`, {
cwd,
shell: is.windows ? 'powershell' : undefined,
})
}
7 changes: 7 additions & 0 deletions src/main/compilation/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ export async function compile(scriptName: string): Promise<string> {
}

if (err instanceof Error) {
if (err.message.includes('ENAMETOOLONG')) {
throw new CompilationException(
scriptName,
"Cannot compile this script: 'Command line is too long'. You have too many mods source scripts. Try to reduce the number of mods that have psc files. This is a Windows limitation and PCA can't do anything. Refer to https://documentation.pca-dev.app/docs/troubleshooting/command-line-too-long",
)
}

const e = err as ExecException
logger.error('compilation error', {
message: e.message,
Expand Down

0 comments on commit c25fa7b

Please sign in to comment.