ProcessBuilder interface apparently takes a string designating some command to run by the OS. Apparently this does not go through the shell, as
"echo $PATH".! simply echoes the string
$PATH rather than the value of the environment variable. However, it does successfully parse the line and separate the command from its arguments, presumably by looking for white space.
Can someone explain how this works? For example, if a file name on the command line contains a space, will this be interpreted as two separate characters.
I only noticed that if I surround the command line arguments such as file names with quotation marks, the quotation marks are interpreted as part of the file name.
I tried to pass an
Array rather than string, but that doesn’t work. Apparently there is no
! method on
Array[String] as I would expect.
Array("cmd","-arg1","-arg2").! // fails to compile
ProcessBuilder interface give me actual control over the command line, or is it only controlled by built-in heuristics?