With 'Save As', the new file is not executable


If you use ‘Save As…’, the new file is not executable, and I have to do a change mode every time. Is there a way to make the file executable automatically (or copy the mode from the original file)?


What operating system are you asking about?


macOS 10.13


You should consider using init.coffee:

{BufferedProcess} = require('atom')

atom.workspace.observeTextEditors (editor) ->
  editor.onDidSave (evt) ->
    process = new BufferedProcess('chmod', ['777', evt.path], (output) => console.log(output))


That doesn’t work, I get this error:


The new file is created, but the mode is still not executable.



I copied your command and put it in init.coffee, except I changed the mode from ‘777’ to ‘700’.


Hmm. Try ['700 ' + evt.path]. All args requires is an array of strings, so I’m not sure what’s bad about what I’ve written.