fix: escape newlines in shell arguments on Windows

close #70
This commit is contained in:
weishu
2026-01-17 19:59:59 +08:00
parent c44eae0b17
commit 3f465cd47d
3 changed files with 16 additions and 4 deletions
+10
View File
@@ -0,0 +1,10 @@
/**
* Strip newlines when passing args through Windows cmd.exe.
* cmd.exe treats CR/LF as command separators and truncates multiline args.
*/
export function stripNewlinesForWindowsShellArg(value: string): string {
if (process.platform !== 'win32') {
return value;
}
return value.replace(/\r?\n/g, ' ');
}