Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command attributes #48

Open
rbrzezinski opened this issue Dec 18, 2017 · 0 comments
Open

Command attributes #48

rbrzezinski opened this issue Dec 18, 2017 · 0 comments

Comments

@rbrzezinski
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant