System.cmd - No such file or directory

Hello, I am trying to run an lp (That is LP in caps for clarity), and am getting an error:
/usr/bin/lp: No such file or directory

that executable exists on the box because ‘which lp’ returns /usr/bin/lp

Here is how I am running it:

 System.cmd("/usr/bin/lp", [
      "-h",
      "printer:631",
      "-U",
      "printuser",
      "-o",
      "fit-to-page",
      "-d",
      name,
      path
    ])

I have also tried by not providing the full path to lp but also get the same error. Additionally, i’ve tried with :os.cmd and that also shows the same error… Anyone have any ideas?

Does the file exist that are specified via name and path?

1 Like

Yes: File.exists?("/usr/bin/lp") returns true. Sorry I should have mentioned that.

Im Not asking if lp exists, but if the file you specify as print target via path and name.

1 Like

Please show the exact error message. Does System.cmd("which", ["lp"]) return the expected path? Are you running inside docker or some other construct?

3 Likes