1

I want to use a node script that uses a xvfb (virtual X server). I have this command:

xvfb-run -a --server-args="-screen 0 1366x768x24" node something.js

which works in the terminal. But when I try to rewrite it to the Elixir:

System.cmd "xvfb-run", ["-a", "--server-args=\"-screen 0 
1366x768x24\"", "node", "something.js"]

then I have error which is saying that I need xvfb. It's the same error that I get when I run just node something.js.

I tried Porcelain:

Porcelain.exec "xvfb-run", ["-a", "--server-args=\"-screen 0 
1366x768x24\"", "node", "something.js"]

but it has the same problem. Maybe I'm not using it properly?

I also tried an erlang's os lib:

"xvfb-run -a --server-args=\"-screen 0 1366x768x24\" node something.js"
|> String.to_charlist
|> :os.cmd
|> to_string

which works better, it doesn't have the xvfb problem, but it get stuck in middle of script without any warnings. The command is not terminating, the node script is just not going further.

I know that I can write small .sh script for that. But it would be nice to get this work in plain Elixir

Ubuntu 12.04

2
  • 1
    Try removing both the \" from the second argument (i.e. make it "--server-args=-screen 0 1366x768x24"). They should not be there when invoking a command with a list of arguments like this. Commented Mar 26, 2018 at 10:56
  • Thanks, I changed it to "--server-args=-screen\ 0\ 1366x768x24" and now it works Commented Mar 26, 2018 at 20:01

1 Answer 1

1

There was a problem with ". I have changed the argument

"--server-args=\"-screen 0 1366x768x24\""

to

"--server-args=-screen\ 0\ 1366x768x24"

and now it works

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.