noseglid / atom-build

:hammer: Build your project directly from the Atom editor
https://atom.io/packages/build
MIT License
248 stars 97 forks source link

How to call Windows/Mac binary with arguments? #466

Closed mhulse closed 7 years ago

mhulse commented 7 years ago

Hi,

I need to call a binary that's located here:

C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe
/Applications/Adobe ExtendScript Toolkit CC/ExtendScript Toolkit.app/Contents/MacOS/ExtendScript Toolkit

From my settings() method, I'm returning this (scriptPath is one of the above depending on OS):

{
    name: 'ExtendScript: Run',
    exec: scriptPath + ' -run',
    args: [ '{FILE_ACTIVE}' ],
    cwd: '{FILE_ACTIVE_PATH}',
    sh: false,
    keymap: 'alt-cmd-b',
    atomCommandName: 'extendscript:run',
    errorMatch: errorMatch
},

My goal is to call the binary and pass it the current active file.

When I run the build, I get:

Unable to execute: /Applications/Adobe ExtendScript Toolkit CC/ExtendScript Tool kit.app/Contents/MacOS/ExtendScript Toolkit -run cmd cannot contain space. Use args for arguments. Make sure cmd:'/Applications/Adobe ExtendScript Toolkit CC/ExtendScript Toolkit. app/Contents/MacOS/ExtendScript Toolkit -run' and cwd:'/Users/mhulse/Desktop' ex ists and have correct access permissions.

Curious if this is related to PR #448?

If so, is there any way for me to work around this issue until it gets patched?

Is there a better way to call a binary like I'm trying to do above?

Thanks!

alygin commented 7 years ago

You combine the -r argument with the executable path, which is wrong and the error message is quite clear on that. All the arguments must go to the args array:

{
    ...
    exec: scriptPath,
    args: [ '-run', '{FILE_ACTIVE}' ],
    ...
},
mhulse commented 7 years ago

You combine the -r argument with the executable path, which is wrong and the error message is quite clear on that. All the arguments must go to the args array:

Ahhhhhh, I see!

Thanks @alygin, I'm trying that now. Bbs to update and close issue. Thank you so much!

mhulse commented 7 years ago

Bbs to update and close issue

Hellz yeah! It worked. That's rad. Thanks again @alygin!