6
Kiedy próbuję uruchomić polecenia powłoki na Mac, to działało jak oczekiwano tak:wykonywania poleceń powłoki w kodzie Scala na Windows wydaje się wymagać pełnej ścieżki bezwzględnej polecenia
scala> import scala.sys.process._
import scala.sys.process._
scala> """protractor --version"""!
warning: there were 1 feature warning(s); re-run with -feature for details
Version 0.24.0
res12: Int = 0
scala>
Ale jeśli mogę to zrobić na Windows, otrzymuję to:
scala> import scala.sys.process._
import scala.sys.process._
scala> """protractor --version"""!
warning: there were 1 feature warning(s); re-run with -feature for details
java.io.IOException: Cannot run program "protractor": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
wydaje się, że muszę zrobić to w ten sposób w systemie Windows:
scala> import scala.sys.process._
scala> """C:\Users\twer\AppData\Roaming\npm\protractor.cmd --version"""!
warning: there were 1 feature warning(s); re-run with -feature for details
Version 0.24.0
res11: Int = 0
scala>
muszę dostarczyć t pełna pełna ścieżka dowodzenia.
Ale jestem pewien, że polecenie jest dostępne na ścieżce.
Czy mimo to można tego uniknąć?