Skip to content

Commit

Permalink
fix(dotnet): project with spaces do not bug out the command (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
asinino authored Feb 28, 2022
1 parent 360d221 commit dd4e16b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/dotnet/src/lib/core/dotnet.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class DotNetClient {
}

build(project: string, parameters?: dotnetBuildOptions): void {
let cmd = `${this.cliCommand.command} build ${project}`;
let cmd = `${this.cliCommand.command} build "${project}"`;
if (parameters) {
parameters = swapKeysUsingMap(parameters, buildKeyMap);
const paramString = parameters ? getParameterString(parameters) : '';
Expand All @@ -50,8 +50,8 @@ export class DotNetClient {
parameters?: dotnetRunOptions,
): ChildProcess {
let cmd = watch
? `watch --project ${project} run`
: `run --project ${project}`;
? `watch --project "${project}" run`
: `run --project "${project}"`;
if (parameters) {
parameters = swapKeysUsingMap(parameters, runKeyMap);
const paramString = parameters ? getParameterString(parameters) : '';
Expand All @@ -69,7 +69,7 @@ export class DotNetClient {
watch?: boolean,
parameters?: dotnetTestOptions,
): void | ChildProcess {
let cmd = watch ? ` watch --project ${project} test` : `test ${project}`;
let cmd = watch ? `watch --project "${project}" test` : `test "${project}"`;
cmd = `${this.cliCommand.command} ${cmd}`;

if (parameters) {
Expand Down Expand Up @@ -97,7 +97,7 @@ export class DotNetClient {
pkg: string,
parameters?: dotnetAddPackageOptions,
): void {
let cmd = `${this.cliCommand.command} add ${project} package ${pkg}`;
let cmd = `${this.cliCommand.command} add "${project}" package ${pkg}`;
if (parameters) {
parameters = swapKeysUsingMap(parameters, addPackageKeyMap);
const paramString = parameters ? getParameterString(parameters) : '';
Expand All @@ -118,7 +118,7 @@ export class DotNetClient {
publishProfile?: string,
extraParameters?: string,
): void {
let cmd = `${this.cliCommand.command} publish ${project}`;
let cmd = `${this.cliCommand.command} publish "${project}"`;
if (parameters) {
parameters = swapKeysUsingMap(parameters, publishKeyMap);
const paramString = parameters ? getParameterString(parameters) : '';
Expand All @@ -139,7 +139,7 @@ export class DotNetClient {
}

restorePackages(project: string): void {
const cmd = `${this.cliCommand.command} restore ${project}`;
const cmd = `${this.cliCommand.command} restore "${project}"`;
return this.logAndExecute(cmd);
}

Expand All @@ -149,7 +149,7 @@ export class DotNetClient {
}

format(project: string, parameters?: dotnetFormatOptions): void {
let cmd = `${this.cliCommand.command} format ${project}`;
let cmd = `${this.cliCommand.command} format "${project}"`;
if (parameters) {
parameters = swapKeysUsingMap(parameters, formatKeyMap);
const paramString = parameters ? getParameterString(parameters) : '';
Expand Down

0 comments on commit dd4e16b

Please sign in to comment.