1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-17 20:48:11 +02:00

splitCommandOptions for bundleDefaultPlugins

This commit is contained in:
palerdot 2023-04-11 18:08:17 +05:30
parent 0b3919fd62
commit a0fd942a1c
3 changed files with 9 additions and 4 deletions

View File

@ -41,7 +41,7 @@ async function downloadFile(url: string, outputPath: string) {
export async function extractPlugins(currentDir: string, defaultPluginDir: string, downloadedPluginsNames: PluginIdAndName): Promise<void> {
for (const pluginId of Object.keys(downloadedPluginsNames)) {
await execCommand(`tar xzf ${currentDir}/${downloadedPluginsNames[pluginId]}`, { quiet: true });
await execCommand(`tar xzf ${currentDir}/${downloadedPluginsNames[pluginId]}`, { quiet: true, splitCommandOptions: { handleEscape: false } });
await move(`package/publish/${pluginId}.jpl`, `${defaultPluginDir}/${pluginId}/plugin.jpl`, { overwrite: true });
await move(`package/publish/${pluginId}.json`, `${defaultPluginDir}/${pluginId}/manifest.json`, { overwrite: true });
await remove(`${downloadedPluginsNames[pluginId]}`);

View File

@ -1,6 +1,6 @@
import * as execa from 'execa';
import commandToString from './commandToString';
import splitCommandString from './splitCommandString';
import splitCommandString, { SplitCommandOptions } from './splitCommandString';
import { stdout } from 'process';
interface ExecCommandOptions {
@ -8,6 +8,7 @@ interface ExecCommandOptions {
showStdout?: boolean;
showStderr?: boolean;
quiet?: boolean;
splitCommandOptions?: SplitCommandOptions | null;
}
export default async (command: string | string[], options: ExecCommandOptions | null = null): Promise<string> => {
@ -33,7 +34,7 @@ export default async (command: string | string[], options: ExecCommandOptions |
}
}
const args: string[] = typeof command === 'string' ? splitCommandString(command) : command as string[];
const args: string[] = typeof command === 'string' ? splitCommandString(command, options.splitCommandOptions || null) : command as string[];
const executableName = args[0];
args.splice(0, 1);
const promise = execa(executableName, args);

View File

@ -1,4 +1,8 @@
export default (command: string, options: any = null) => {
export interface SplitCommandOptions {
handleEscape?: boolean;
}
export default (command: string, options: SplitCommandOptions | null = null) => {
options = options || {};
if (!('handleEscape' in options)) {
options.handleEscape = true;