mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-05-08 06:14:36 +02:00
#628 - Fix path and data argument
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
- [#628](https://github.com/estruyf/vscode-front-matter/issues/628): Fix path argument and JSON data on custom scripts
|
||||
|
||||
## [9.0.0] - 2023-08-21 - [Release notes](https://beta.frontmatter.codes/updates/v9.0.0)
|
||||
|
||||
### 🌎 Multilingual support
|
||||
|
||||
@@ -222,7 +222,12 @@ export class CustomScript {
|
||||
let articleData = '';
|
||||
if (os.type() === 'Windows_NT') {
|
||||
const jsonData = JSON.stringify(article?.data);
|
||||
articleData = `'${jsonData.replace(/"/g, `\"`)}'`;
|
||||
|
||||
if (script.command && script.command.toLowerCase() === "powershell") {
|
||||
articleData = `'${jsonData.replace(/"/g, `\\"`)}'`;
|
||||
} else {
|
||||
articleData = `"${jsonData.replace(/"/g, `\\"`)}"`;
|
||||
}
|
||||
} else {
|
||||
articleData = JSON.stringify(article?.data).replace(/'/g, '%27');
|
||||
articleData = `'${articleData}'`;
|
||||
@@ -360,7 +365,11 @@ export class CustomScript {
|
||||
return;
|
||||
}
|
||||
|
||||
const fullScript = `${command} ${scriptPath} ${args}`;
|
||||
if (osType === 'Windows_NT' && command.toLowerCase() === "powershell") {
|
||||
command = `${command} -File`;
|
||||
}
|
||||
|
||||
const fullScript = `${command} "${scriptPath}" ${args}`;
|
||||
Logger.info(`Executing: ${fullScript}`);
|
||||
|
||||
exec(fullScript, { cwd: wsPath }, (error, stdout) => {
|
||||
|
||||
Reference in New Issue
Block a user