|
@@ -166,8 +166,9 @@ public class LocalProcess {
|
|
* - Parameter executable: The executable to launch inside the pseudo terminal, defaults to /bin/bash
|
|
* - Parameter executable: The executable to launch inside the pseudo terminal, defaults to /bin/bash
|
|
* - Parameter args: an array of strings that is passed as the arguments to the underlying process
|
|
* - Parameter args: an array of strings that is passed as the arguments to the underlying process
|
|
* - Parameter environment: an array of environment variables to pass to the child process, if this is null, this picks a good set of defaults from `Terminal.getEnvironmentVariables`.
|
|
* - Parameter environment: an array of environment variables to pass to the child process, if this is null, this picks a good set of defaults from `Terminal.getEnvironmentVariables`.
|
|
|
|
+ * - Parameter execName: If provided, this is used as the Unix argv[0] parameter, otherwise, the executable is used as the args [0], this is used when the intent is to set a different process name than the file that backs it.
|
|
*/
|
|
*/
|
|
- public func startProcess(executable: String = "/bin/bash", args: [String] = [], environment: [String]? = nil)
|
|
|
|
|
|
+ public func startProcess(executable: String = "/bin/bash", args: [String] = [], environment: [String]? = nil, execName: String? = nil)
|
|
{
|
|
{
|
|
if running {
|
|
if running {
|
|
return
|
|
return
|
|
@@ -175,7 +176,11 @@ public class LocalProcess {
|
|
var size = delegate.getWindowSize ()
|
|
var size = delegate.getWindowSize ()
|
|
|
|
|
|
var shellArgs = args
|
|
var shellArgs = args
|
|
- shellArgs.insert(executable, at: 0)
|
|
|
|
|
|
+ if let firstArgName = execName {
|
|
|
|
+ shellArgs.insert (firstArgName, at: 0)
|
|
|
|
+ } else {
|
|
|
|
+ shellArgs.insert(executable, at: 0)
|
|
|
|
+ }
|
|
|
|
|
|
var env: [String]
|
|
var env: [String]
|
|
if environment == nil {
|
|
if environment == nil {
|