Unix executable not found

#1

When I run the command “dot”.! from within the worksheet, I get the following error

cmd = List(dot, -Tpng, /var/folders/ry/dmz1d8k97sv7hlfy0fr7zcnc0000gq/T/bdd1801680091063259860.dot, -o, /var/folders/ry/dmz1d8k97sv7hlfy0fr7zcnc0000gq/T/bdd8998799402306837081.png)
java.io.IOException: Cannot run program "dot": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at scala.sys.process.ProcessBuilderImpl$Simple.run(ProcessBuilderImpl.scala:75)
at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.run(ProcessBuilderImpl.scala:104)
at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang(ProcessBuilderImpl.scala:118)
at bdd.GraphViz$.bddToPng(GraphViz.scala:47)
at bdd.GraphViz$.bddView(GraphViz.scala:32)
at bdd.GraphViz$GraphVizOps$.bddView$extension(GraphViz.scala:126)
... 40 elided
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

However, when I run the same code from a main method of an object it works fine.
Is this a bug in the worksheet?

#2

What if you provide full path to dot? I assume it’s not in your current working directory.

#3

Didn’t try it but I’m pretty sure using the full path will work. Just bizarre that it works when called from the main method but not from the worksheet. Looks like java is getting started with different unix environments, PATH etc?

#4

You can check it yourself:

	println(sys.props("user.dir"))
	println(sys.env("PATH"))
#5

Hello
You may not have access to directory / files

maybe problem access
/var/folders/ry/…

#6

Apparently the UNIX environment supplied to the java process in the worksheet is very different from that provided by the main method of an object.

Here is the environment I have from the worksheet

import sys.process._

"printenv".!

producing the following output

import sys.process._

TMPDIR=/var/folders/ry/dmz1d8k97sv7hlfy0fr7zcnc0000gq/T/
__CF_USER_TEXT_ENCODING=0x1F7:0x0:0x0
HOME=/Users/jnewton
SHELL=/bin/csh
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.QKBApjg6am/Render
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.guZ2l0A8EW/Listeners
PATH=/usr/bin:/bin:/usr/sbin:/sbin
LOGNAME=jnewton
DISPLAY=/private/tmp/com.apple.launchd.rjMFCLeXIn/org.macosforge.xquartz:0
XPC_SERVICE_NAME=com.jetbrains.intellij.ce.55712
USER=jnewton
XPC_FLAGS=0x0
JAVA_MAIN_CLASS_78564=org.jetbrains.plugins.scala.nailgun.NailgunRunner
res0: Int = 0

And the environment from the main method of an object

object unixEnvTest {
  def main(argv:Array[String]):Unit = {
    import sys.process._
    
    "printenv".!
  }
}

produces the following

PATH=/Users/jnewton/bin:/usr/local/bin:/Library/TeX/texbin:/usr/texbin:/usr/local/opt/qt5/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
LOGTALKUSER=/Users/jnewton/logtalk
HOST=johan.lrde.epita.fr
__LOGIN=76771
GROUP=staff
MACHTYPE=x86_64
DISPLAY=/private/tmp/com.apple.launchd.rjMFCLeXIn/org.macosforge.xquartz:0
OSTYPE=darwin
LOGNAME=jnewton
XPC_SERVICE_NAME=com.jetbrains.intellij.ce.55712
PWD=/Users/jnewton/sw/regular-type-expression/cl-robdd/src/cl-robdd-scala
SHELL=/bin/csh
HOMEBREW_GITHUB_API_TOKEN=088cec40f1f961f3b49f01c99876a58cb864331e
HOSTTYPE=unknown
USER=jnewton
TMPDIR=/var/folders/ry/dmz1d8k97sv7hlfy0fr7zcnc0000gq/T/
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.guZ2l0A8EW/Listeners
EDITOR=emacs
XPC_FLAGS=0x0
__CF_USER_TEXT_ENCODING=0x1F7:0x0:0x0
VENDOR=apple
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.QKBApjg6am/Render
LOGTALKHOME=/opt/local/share/logtalk
LC_CTYPE=en_US.UTF-8
HOME=/Users/jnewton
JAVA_MAIN_CLASS_78610=bdd.unixEnvTest