1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Automator works but says fails

Discussion in 'Mac Programming' started by kiantech, May 9, 2011.

  1. macrumors regular

    Hey guys, I basically have a automator do a bunch of stuff then execute a shell script to run a couple java programs I wrote. When I run the automation everything works, including executing my java files, however I get a run shell script error. Even though everything I wanted to happen...happened.

    Here is my shell script...with just a change to the long folder

    cd thedirectoryIwant
    java NBAFileParser
    java NBAWriteUSB

    Thats it. Automator runs my java files, but then returns this error.

    Run Shell Script failed - 1

    Anyone of a clue, I would greatly appreciate it.
  2. macrumors 65816


    Bash returns the exit status of the last command executed, unless a syntax error occurs, in which case it exits with a non-zero value. I can't see a syntax error, assuming thedirectoryIwant is properly encoded if it contains exotic characters.

    Is NBAWriteUSB calling System.exit(1) somewhere or raising an uncaught exception?

    If you put exit 0 at the last line of your shell script, does it stop the error from appearing?
  3. macrumors regular

    Hey thanks for the suggestion, I didn't try that, however I was able to fix it by writing an applescript instead. At first I got a similar error, but after a little googling I was got a suggestion to just do a try statement, and in that statement I run my shell script.

    on run
    do shell script "/dir/ransmit.sh"
    end try
    end run

    that worked, but next time I have a problem I will try your method too.

Share This Page