Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

system-console and tcl exec

I'm using Quartus 11.1 and Windows 7

There is a difference in system-console's behavior depending on how it is invoked. If I start system-console from a Nios command shell, I can use the tcl exec command, such as

exec dir

returning my local directory contents. However, if I invoke system-console from either qsys/tools or Eclipse/NiosII and try the same exec, I get

error: couldn't execute "dir": no such file or directory

while executing

"exec dir"

In this context, exec doesn't seem to understand anything.

The auto_path var is the same for both. What else could be missing or different?

7 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    What else could be missing or different?

    --- Quote End ---

    The shell where 'exec' gets invoked is probably different.

    I'm not sure how to force the correct shell. I also had a similar issue in Modelsim, but never had time to look at it further.

    It might be that you need wrap all 'exec' targets in a bash shell with# !/bin/bash at the beginning, to force the use of the correct shell.

    However, as I commented, I have not looked into this problem ... but perhaps this comment will help you find the solution.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    does qexec have the same problem?

    --- Quote End ---

    I'm not sure what you mean - qexec does not show up in the list of available tcl commands:

    info commands *exec

    only returns exec

    ----- post edited here! 17:04 EST ---------

    in system-console, attemptingpackage require ::quartus::misc

    to get qexec loaded doesn't work. I've never tried to use quartus packages in system-console, so I don't know if it's even possible or if a different syntax is required.

    In the quartus tcl console, I get this trying to use qexec:qexec ls

    error:while executing

    error:"qexec ls"

    ::quartus::misc is shown as a loaded package
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    The shell where 'exec' gets invoked is probably different.

    I'm not sure how to force the correct shell. I also had a similar issue in Modelsim, but never had time to look at it further.

    It might be that you need wrap all 'exec' targets in a bash shell with# !/bin/bash at the beginning, to force the use of the correct shell.

    However, as I commented, I have not looked into this problem ... but perhaps this comment will help you find the solution.

    Cheers,

    Dave

    --- Quote End ---

    Neither exec bash ./myscript

    nor exec sh ./myscript

    gets a good response

    myscript has a# !/bin/bash header

    (In the working system-console, either syntax is successful)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    After some more experiments my conclusion is that exec works if system-console is hosted in a bash shell, and not if it's hosted by a native windows shell or windows process (such as Quartus).

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    After some more experiments my conclusion is that exec works if system-console is hosted in a bash shell, and not if it's hosted by a native windows shell or windows process (such as Quartus).

    --- Quote End ---

    Ok. That was what I was thinking too, however, the comments on the link I posted made me think otherwise.

    So the question then becomes, how can you select the shell? I suspect the answer is that the shell is fundamental to the process, since when you launch the application, it inherits the shell. The solution might be to replace system-console with a bash script that starts system-console. That way when you execute system-console from a windows shell, you would actually be executing the script, which in turn executes bash, and then the real system-console application. With that setup, the shell should be bash.

    Cheers,

    Dave