Skip to content

Commit

Permalink
Remove extra space to fix VS debug attachment (#4333)
Browse files Browse the repository at this point in the history
Resolves #4332

extra space in argument for `child_process.spawn` ended up into missing
  • Loading branch information
live1206 authored Sep 4, 2024
1 parent 0f8dcf4 commit eacbc24
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/http-client-csharp/emitter/src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ export async function $onEmit(context: EmitContext<NetEmitterOptions>) {
const existingProjectOption = options["existing-project-folder"]
? `--existing-project-folder ${options["existing-project-folder"]}`
: "";
const debugFlag = (options.debug ?? false) ? " --debug" : "";
const debugFlag = (options.debug ?? false) ? "--debug" : "";

const emitterPath = options["emitter-extension-path"] ?? import.meta.url;
const projectRoot = findProjectRoot(dirname(fileURLToPath(emitterPath)));
const generatorPath = resolvePath(
projectRoot + "/dist/generator/Microsoft.Generator.CSharp.dll"
);

const command = `dotnet --roll-forward Major ${generatorPath} ${outputFolder} -p ${options["plugin-name"]} ${newProjectOption} ${existingProjectOption}${debugFlag}`;
const command = `dotnet --roll-forward Major ${generatorPath} ${outputFolder} -p ${options["plugin-name"]}${constructCommandArg(newProjectOption)}${constructCommandArg(existingProjectOption)}${constructCommandArg(debugFlag)}`;
Logger.getInstance().info(command);

const result = await execAsync(
Expand Down Expand Up @@ -180,6 +180,10 @@ export async function $onEmit(context: EmitContext<NetEmitterOptions>) {
}
}

function constructCommandArg(arg: string): string {
return arg !== "" ? ` ${arg}` : "";
}

async function execAsync(
command: string,
args: string[] = [],
Expand Down

0 comments on commit eacbc24

Please sign in to comment.