Method specification
UNIXProcess methods and usage examples are described in the following section.
UNIXProcess class methods
 
CurrentShell
Returns a string naming the shell which will be used by shell:, execute:, execute:input:output:error:environment; and system: . If not set, lazy initialization will either take the value from the SHELL environment variable; or use ‘bash’ if the SHELL variable is not set.
 
CurrentShell:
Sets the name of the shell executable as a string, e.g., 'bash'. Note: '/bin' will be prefixed as the path before command execution.
 
endAsyncIO
Ends the background Smalltalk process handling asynchronous I/O.
 
execute:
Creates a process to execute the specified string using the shell specified by CurrentShell in the current environment. Starts the process running and answers the process. If an error occurs starting the process, answers nil.
 
execute:input:output:error:environment:
Creates a process to execute the specified string using the shell specified by CurrentShell and the given environment. Starts the process running and answers the process. If an error occurs starting the process, answers nil. If any of the I/O parameters are not nil, initializes the appropriate stdin, stdout, and stderr pipes.
 
shell:
Invokes a shell specified by CurrentShell that executes the specified string in the current environment. Answers the stdout contents and stderr contents concatenated. If an error occurs starting the process, generates a walkback.
 
startAsyncIO
Starts a background Smalltalk process to grab I/O for the active UNIXProcess and moves it between Smalltalk and the operating system.
 
system:
Invokes a shell that executes the specified string in the current environment. Answers the integer exitCode of the process. If an error occurs starting the process, answers nil. If the UNIX primitive for completion checking fails, generates a walkback.
UNIXProcess methods
 
closePipe:
Closes the specified pipe. Generates a walkback if the pipe is not valid.
 
complete
Obsolete protocol retained for compatibility. It should be replaced with isComplete
 
exitCode
Answers an integer representing the receiver's exitCode. If the process has not completed, answers nil. This is operating-system dependent.
 
fillPipe:
Flushes all data in the pipe from the operating system process associated with the receiver to the Smalltalk UNIXReadPipeStream. Generates a walkback if the specifed pipe stream is not an instance of UNIXReadPipeStream or is not a valid UNIXPipeStream.
 
id
Obsolete protocol retained for compatibility. Should be replaced with pid.
 
isComplete
Answers true if the receiver process has completed, answers false if not. If the UNIX primitive for completion checking fails, generates a walkback.
 
kill
Kills the receiver process. Try using the SIGTERM signal first. If the process does not die within 5 seconds, sends the SIGKILL signal. This method blocks until the process dies. Answers the receiver.
 
nextFrom:
Answers the next available character from the receiver's stdout. If the read would block, answers nil. On any other error answers a character with a value of zero.
 
nextPut:on:
Writes a character to the receiver's stdin pipe, specified by on:. Generates a walkback if the pipe is not valid. Answers the character.
 
pid
Answers the integer representing the process id of the receiver's operating system process. If there is no corresponding operating system process, answers nil.
 
run
Obsolete protocol retained for compatibility. The execute:input:output:error:environment: message encompasses this behavior.
 
stderr
Answers a UNIXReadPipeStream representing the receiver's stderr pipe, or nil if the pipe is undefined.
 
stdin
Answers a UNIXWritePipeStream representing the receiver's stdin pipe, or nil if the pipe is undefined.
 
stdout
Answers a UNIXReadPipeStream representing the receiver's stdout pipe, or nil if the pipe is undefined.
 
waitForCompletion
Ensures the receiver has finished the last operation. Answers the exitCode of the process. This is a blocking operation. If the stdin pipe has not been closed, the operation may block indefinitely.
Last modified date: 01/29/2015