atom-script icon indicating copy to clipboard operation
atom-script copied to clipboard

Something broke running shell scripts

Open danielbayley opened this issue 12 years ago • 11 comments

I'm getting a Command not configured for Shell Script! error since updating Atom to v0.142.0

danielbayley avatar Nov 07 '14 18:11 danielbayley

Seems to be caused by the PATH environment variable being constructed differently.

Specifically this change; Fixed an issue on Yosemite where the PATH environment variable value was not correct. made in v0.142.0 seems to be the culprit.

danielbayley avatar Nov 07 '14 18:11 danielbayley

Or, maybe the error is because 'Shell Script (Bash)' has been accidentally quoted here (in the lib/grammars.coffee file?

Ruby:
    "Selection Based":
      command: "ruby"
      args: (context)  -> ['-e', context.getCode()]
    "File Based":
      command: "ruby"
      args: (context) -> [context.filepath]

  'Ruby on Rails':
    "Selection Based":
      command: "rails"
      args: (context)  -> ['runner', context.getCode()]
    "File Based":
      command: "rails"
      args: (context) -> ['runner', context.filepath]

  'Shell Script (Bash)':
    "Selection Based":
      command: "bash"
      args: (context)  -> ['-c', context.getCode()]
    "File Based":
      command: "bash"
      args: (context) -> [context.filepath]

danielbayley avatar Nov 07 '14 19:11 danielbayley

Or, maybe the error is because 'Shell Script (Bash)' has been accidentally quoted here

The quotes are required since spaces/special characters are used in the key name.

I'll check this out when I get home and have a Yosemite machine.

erran avatar Nov 07 '14 20:11 erran

I'm having the exact same issue as danielbayley described.

andrewpong avatar Nov 08 '14 00:11 andrewpong

Actually this is a much bigger problem than I thought; nothing will run at all now in any language.

Yosemite can't be the issue since it's been working fine prior to this ever since I upgraded last month.

I hard coded my correct PATH environment variable into Atom's init.coffee script but the problem persists.

So I would say it must be something that has changed in the latest couple of updates to Atom itself. Hopefully that might narrow it down a little.

danielbayley avatar Nov 09 '14 16:11 danielbayley

I think this may be related to the PATH change commit in OS X - atom/atom@6a58f60 from the v0.142.0 release of Atom. I'm still stuck to only a Mavericks system at this point. I'll test this when possible. It does sound like an issue with Atom detecting the PATH vs. anything from Script. I'd appreciate if you could show a screenshot of the error and show the value of PATH.

Configuration (with Mavericks)

screen shot 2014-11-09 at 11 53 08 screen shot 2014-11-09 at 11 55 44

erran avatar Nov 09 '14 18:11 erran

Oh, and a screenshot of this working using the latest Atom release on Mavericks. screen shot 2014-11-09 at 12 16 43

erran avatar Nov 09 '14 18:11 erran

See atom/atom-shell#550

erran avatar Nov 09 '14 18:11 erran

Yeah I came across that issue thread and suspected it might have something to do with the problem, so I did a few tests.

So if I open Atom the usual way (for me) from my dock, then the PATH is the wrong cut down version, whereas if I launch Atom from Terminal then the PATH is correct (as in, matching the PATH set in my ~/.bashrc). The latter being what I think that PR has addressed for folks who open Atom that way, but is of little use to me. For now anyway, I've fixed this by hard coding the correct PATH into the init.coffee script as I mentioned before.

Scratch what I said before about Script not running in any language, since applying the above 'fix', the problem now does seem to be confined to bash (iv'e been running system attribute "PATH" using Script to check it under AppleScript, and I also tested JavaScript and others which also work).

So I guess it can't be the PATH after all?

##AppleScript

applescript

##Bash

bash

danielbayley avatar Nov 09 '14 19:11 danielbayley

The grammar that failed in your case is "Shell Script". That leads me to believe the grammar detection is at fault. As far as I know grammars.coffee includes different variants of Shell Script but would report "Shell Script (Bash)" or similar instead. I'll post a possible patch for that issue once I'm at the keyboard which I'd like you to test.

Sent from my iPhone

On Nov 9, 2014, at 13:45, Daniel [email protected] wrote:

Yeah I came across that issue thread and suspected it might have something to do with the problem, so I did a few tests.

So if I open Atom the usual way (for me) from my dock, then the PATH is the wrong cut down version, whereas if I launch Atom from Terminal then the PATH is correct (as in, matching the PATH set in my ~/.bashrc). The latter being what I think that PR has addressed for folks who open Atom that way, but is of little use to me. For now anyway, I've fixed this by hard coding the correct PATH into the init.coffee script as I mentioned before.

Scratch what I said before about Script not running in any language, since applying the above 'fix', the problem now does seem to be confined to bash (iv'e been running system attribute "PATH" using Script to check it under AppleScript, and I also tested JavaScript and others which also work).

So I guess it can't be the PATH after all?

##AppleScript

##Bash

— Reply to this email directly or view it on GitHub.

erran avatar Nov 09 '14 20:11 erran

Sure, will do.

danielbayley avatar Nov 09 '14 21:11 danielbayley