Skip to content

Arguments parser error in execute function #33

@piferrari

Description

@piferrari

In Endpoint/Containers.php the execute function parse incorrectly dotnet arguments command.

Example:

$cmd = 'dotnet test SomeCSharpSolution.sln --nologo --logger:"trx;LogFileName=result.trx"';

$r = $lxd->containers->execute('container-name', $cmd);

Expected parameters parsing result:

array(1) {
  ["command"]=>
  array(5) {
    [0]=>
    string(6) 'dotnet'
    [1]=>
    string(4) 'test'
    [2]=>
    string(25) 'SomeCSharpSolution.sln'
    [3]=>
    string(8) '--nologo'
    [4]=>
    string(36) '--logger:"trx;LogFileName=result.trx"'
  }

But the actual result is:

array(1) {
  ["command"]=>
  array(6) {
    [0]=>
    string(6) "dotnet"
    [1]=>
    string(4) "test"
    [2]=>
    string(25) "SomeCSharpSolution.sln"
    [3]=>
    string(8) "--nologo"
    [4]=>
    string(9) "--logger:"
    [5]=>
    string(39) "trx;LogFileName=result.trx"
  }

This incorrect parsing give this dotnet result

MSBUILD : error MSB1008: Only one project can be specified.
Switch: trx;LogFileName=result.trx

For switch syntax, type "MSBuild -help"

I think the problem is in the split function, in the regex (line 691 in Containers.php) but i don't know how to fix this.

Perhaps it is not this php-lxd library that should solve this problem?

But, in this case, how can I pass the arguments?

Thank you for your work.

Best Regards.

PiF

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions