Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16597 Discussions

system-console and tcl exec

Altera_Forum
Honored Contributor II
1,462 Views

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?
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
519 Views

 

--- 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
0 Kudos
Altera_Forum
Honored Contributor II
519 Views

does qexec have the same problem?

0 Kudos
Altera_Forum
Honored Contributor II
519 Views

 

--- 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
0 Kudos
Altera_Forum
Honored Contributor II
519 Views

 

--- 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)
0 Kudos
Altera_Forum
Honored Contributor II
519 Views

 

--- Quote Start ---  

 

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

 

--- Quote End ---  

According to this: 

 

http://phaseit.net/claird/comp.lang.tcl/fmm.html#exec 

 

Tcl exec does not use a shell. 

 

This link has comments regarding trying to "exec dir". Perhaps they apply to your problem. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
519 Views

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).

0 Kudos
Altera_Forum
Honored Contributor II
519 Views

 

--- 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
0 Kudos
Reply