Terminal command not returning stdout like it should

Post Reply
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Terminal command not returning stdout like it should

Post by gabrielp »

Hi guys,

I'm stuck on this annoying issue. I've installed AWS CLI on our production machine but for some reason, even though I can access it fine within Terminal, Switch cannot get any response out of it.



Here is a screenshot showing the result from Switch trying 'aws --version' along with Terminal doing it:





Notice how nothing is in the result for Switch and yet it prints a line in Terminal where the same command is being run.



To prove my scripting example works, here is the same thing with 'curl --version' which works as expected....





Anyone have any idea what is going on here?
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Terminal command not returning stdout like it should

Post by gabrielp »

FYI, I have tested this on two machines running Windows 7 and could not reproduce the issue. It seems to be something with OSX.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Terminal command not returning stdout like it should

Post by dkelly »

curl is a binary executable whereas aws is a python script. It's probably a problem with the shell invoking the correct interpreter. Try prefixing aws command with the path to 'python'.
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Terminal command not returning stdout like it should

Post by gabrielp »

Good call, Dwight. I was able to get it working like this:







But obviously that's not workable because I want it to work across platforms. So how can I fix the OS X environment to respond correctly to 'aws --version'?
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Terminal command not returning stdout like it should

Post by gabrielp »

The first line of this file should be all that's needed...



Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Terminal command not returning stdout like it should

Post by gabrielp »

Annoying issue but I've implemented a simple workaround which, when it fails the first time, tries to prepend 'python /usr/local/bin/' to the command, making it work. This means that for OSX, if you encounter the problem, you'll need your AWS installed in /usr/local/bin/. Kind of a bummer but it was the only way I could get it working.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Terminal command not returning stdout like it should

Post by dkelly »

use s.isMac() to determine if you need to add "python" to command
Post Reply