Running commands on host system

Hi,

I'm trying to run some commands on my host system (Linux) and I've made the following observations:
  1. The SenseTalk reference describes a "ShellCommand" global option, but when I try to use it via:
    SetOption ShellCommand, "/bin/csh"
    
    I get an error:
    setoption Error- Unrecognized Eggplant Option: ShellCommand
    
  2. I cannot background a shell command using the "&" character:
    shell("/path/to/script.csh")
    
    Is there a way to do this?
  3. the open() command only works once, even after the program that I've started is no longer running.
    open "/path/to/script.csh"
    
    [/list:o]

    Can you provide any work-arounds?

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    All SenseTalk global properties are accessed by simply using the word 'the' before the property name, so you can set the ShellCommand global property like this:
    set the ShellCommand to "/bin/csh"
    
    That same syntax works for all Eggplant options now, too (this wasn't always true in the past), so there is little need to use the SetOption command (it's mainly useful when you want to set or restore multiple option values at once).

    The shell command is useful for executing a single command. It seems reasonable that it should be able to run a command in the background by terminating it with "&", but as you've found that doesn't really work (I'm not entirely sure why, but I think the way that call works it wants the child process to complete before it returns).

    An alternative approach that may work for you is to use the "open process" command which gives you a more open-ended connection to a shell process. Then write your command to that shell process (using the "write x to process y" command) and your script should be able to continue executing even though the command doesn't complete.

    The "open" command is intended mainly for launching another program. I don't have immediate access to a Linux system right now to see what your issue might be, but I think that "open process" will be a better approach for what you're trying to do.
Sign In or Register to comment.