#runAndWaitOnExitDo: takes a cull-ed three-arg block with the process, stdout, and stderr; that way you can process stdout and stderr independently.
Try this OSSUnixSubprocess new command: '/usr/bin/java'; arguments: #('-version'); redirectStderr; runAndWaitOnExitDo: [ :process :out :err | err inspect ]. Peter On Mon, Jun 20, 2016 at 6:03 PM, Alexandre Bergel <alexandre.ber...@me.com> wrote: > Hi Mark, > > This is what I thought. But it does not seem to work. I tried: > > OSSUnixSubprocess new > command: '/usr/bin/java'; > arguments: #('-version'); > redirectStderr; > > runAndWaitOnExitDo: [ :process :outString | > outString inspect > ]. > > Or is it the redirectStderr that does not work properly? > > Cheers, > Alexandre > > > > On Jun 20, 2016, at 11:42 AM, Mark Bestley <s...@bestley.co.uk> wrote: > > > > java -version outputs to stderr not stdout (also I don't think you need > JAVA_HOME /usr/bin/java will do what is needed) > > > > > > > > On 20/06/2016 15:58, Alexandre Bergel wrote: > > > >> On OS X, in a terminal, if I type: /usr/bin/java -version > >> I obtain: > >> java version "1.8.0_66" > >> Java(TM) SE Runtime Environment (build 1.8.0_66-b17) > >> Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode) > >> > >> Using OSSubProcess, do-it-ing the following: > >> > >> OSSUnixSubprocess new > >> command: '/usr/bin/java'; > >> arguments: #('-version'); > >> environmentAt: 'JAVA_HOME' put: > '/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home'; > >> redirectStderr; > >> redirectStdout; > >> runAndWaitOnExitDo: [ :process :outString | > >> outString inspect > >> ]. > >> > >> inspect an empty string. > >> Any idea what’s going on? > >> > > > > > > > > -- > > Mark > > > > > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > >