Skip to content

Command attributes #48

@rbrzezinski

Description

@rbrzezinski

Description of Feature / Expected vs Actual Behaviour

Wrong splitting of command attributes and it's breaking process execution.

Steps to reproduce

  1. Create file 'run'
#!/usr/bin/php
<?php
print_r($argv);
?>
  1. Run:
var result = process('./run --file=test --params="add test"').death();
console.log(result.data);
  1. It is displaying:
Array
(
    [0] => ./run
    [1] => --file=queue
    [2] => --params="add
    [3] => aa"
)

But should display:

Array
(
    [0] => ./run
    [1] => --file=queue
    [2] => --params=add aa
)

Additional Information

It's not PHP problem because if you run this command directly in console it works perfectly.

https://github.com/CircleOfNice/CoreWorker/blob/master/lib/NodeProcess.js#L291
It is splitting just by space so this code

var command = './run --file=test --params="add test"';
var splittedCommand = command.split(" ");

produces array:

["./run", "--file=test", '--params="add', 'test"']

but it should produce:

["./run", "--file=test", '--params="add test"']

You can use something like this:
https://www.npmjs.com/package/parse-spawn-args

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions