saleyn / erlexec

Execute and control OS processes from Erlang/OTP
https://hexdocs.pm/erlexec/readme.html
Other
527 stars 139 forks source link

Can't use non-latin characters in cmd argument #91

Closed ghost closed 2 years ago

ghost commented 7 years ago

Any non-latin characters cause errors (sorry for example in Elixir) :

  :exec.run_link 'тест', [:sync, :stdout]
  ** (CaseClauseError) no case clause matching: {:error, 'badarg: invalid command argument #0'}
    (erlexec) src/exec.erl:798: :exec.do_run/2
saleyn commented 7 years ago

Presently we've had no need for this feature. You are welcome to submit a PR if this is needed.

ghost commented 7 years ago

@saleyn Sure I'll do this, but it would be nice to get any hint or advice on implementation.

saleyn commented 7 years ago

First determine if the issue is on the Erlang side or on the C++ side or on both. Try to start the exec in debug mode: exec:start([verbose, debug]) and see what gets printed. If the issue is with unicode support, on the C++ side it would require using std::wstring to store the command, but this needs to be ifdef'd. A better approach would be to keep the command as a binary blob, and convert it to unicode string only when needed.

ghost commented 7 years ago

@saleyn Many thanks, I'll try to do this.

saleyn commented 2 years ago

Added support for unicode executables in the latest commit.